Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML: two <p> and one <div> tag in same line problems

Tags:

html

I am trying to do like this:

Rate example

This is my html code:

<p>' + $(this).text() + '<p>Rate<div id="betygbox"></div></p></p>

I cant be able to make them show on one line

I have tried to put them all in one div tag with display: inline; But it aint working. Is there easy solutions to get it all in one line?

Thanks in advance!

like image 217
Obsivus Avatar asked Dec 22 '25 11:12

Obsivus


2 Answers

<p> tags shouldn't be nested, so that's part of the problem. Try this instead:

'<p>' + $(this).text() + '<span>Rate<span id="betygbox"></span></span></p>
like image 151
wtbgtr Avatar answered Dec 24 '25 03:12

wtbgtr


According to the HTML 4.01 spec, The P element represents a paragraph. It cannot contain block-level elements (including P itself). So, your HTML is not valid.

like image 42
Alexander Pavlov Avatar answered Dec 24 '25 05:12

Alexander Pavlov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!