How can I put div in paragraph? I changed the display to inline, but the browser divide the base paragraph to two element, and div will not member of paragraph.
In HTML, you can nest not only inline tags but also almost any other combination of tags. This way when you apply some custom styling to the <div> tag, it will be applied to the nested <p> tags as well.
div p {.../*styles for p-tags inside a div*/...} will choose both p inside a div in your case.
It is completely acceptable to use a DIV inside a <form> tag. If you look at the default CSS 2.1 stylesheet, div and p are both in the display: block category.
Using a div instide a td is not worse than any other way of using tables for layout. (Some people never use tables for layout though, and I happen to be one of them.) If you use a div in a td you will however get in a situation where it might be hard to predict how the elements will be sized.
form the w3 site:
The P element represents a paragraph. It cannot contain block-level elements (including P itself).
no you cannot nest anything other than an inline element in a <p>
if you want the code to validate
from the property def:
<!ELEMENT P - O (%inline;)* -- paragraph -->
I know it's hard to understand those recs at times, but the bit in brackets means the <p>
can only contain inline
elements
you can (and should) use a <span>
inside a <p>
and if required you could change it's CSS display property to block
or inline-block
and that would be perfectly valid, as CSS properties do not change the actual definitions of an element.. in your case it sounds like you need an inline element so just use a <span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With