Reputation: 20856
I need value "1" to be displayed adjacent to "Id" field but its displaying in a new line.The
tag is supposed to be inline not sure why its being moved to new line.
HTML
<b>Id : <p id="productid">1</p></b>
Upvotes: 0
Views: 39
Reputation: 288000
A <p>
element is a paragraph, which by default is a block element.
In this case, you can't use <p>
because:
<b>
elements (because <p>
can only be used where flow content is expected, but the content model of <b>
is phrasing content). Always remember to validate your code.I suggest using
<b>Id: <span id="productid">1</span></b>
Upvotes: 1
Reputation: 18833
#productid{
display:inline-block;
}
p is a block level element by default. You can set it to display inline-block to make it do as you describe using basic css.
I'm not sure if you are unable to access css, so in case you cannot, see oriol's answer. No reason not to just make it a span.
Bit of a side note, it is a little odd to put a p tag inside a b tag. Technically you CAN do this, but it looks like using a span tag is the more proper way to handle this.
Upvotes: 0