2

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!

3 Answers 3

9

<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>
1
  • 1
    Assuming Rate: [ ] is to be right aligned, don't forget to add span { float: right } to your CSS.
    – Bojangles
    Commented Apr 10, 2012 at 14:23
1

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.

2
  • How can I do it then like my image?
    – Obsivus
    Commented Apr 10, 2012 at 14:22
  • I don't know which layout exactly you are aiming for, but supposing that you want to left-align all the edit fields, you can use table layout, similar to this fiddle. If you need all the fields right-aligned, use JamWaffles' comment on another answer. Commented Apr 10, 2012 at 14:34
0

<p> is not allowed inside <p>.

Read html-specifications.

Not the answer you're looking for? Browse other questions tagged or ask your own question.