Obsivus
Obsivus

Reputation: 8359

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

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!

Upvotes: 2

Views: 1111

Answers (3)

wtbgtr
wtbgtr

Reputation: 687

<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>

Upvotes: 9

Hubert Sch&#246;lnast
Hubert Sch&#246;lnast

Reputation: 8527

<p> is not allowed inside <p>.

Read html-specifications.

Upvotes: 0

Alexander Pavlov
Alexander Pavlov

Reputation: 32306

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.

Upvotes: 1

Related Questions