3 ms·
The second sentence is wrong: there's nothing wrong with nested block elements, but you never nest block elements inside inline elements. For example <div> elem
by wayvey 6y ago
The second sentence is wrong: there's nothing wrong with nested block elements, but you never nest block elements inside inline elements. For example <div> elements are block-level and they are nested all the time. There are some exceptions though such as your example of an <ul> in a <p>. The <p> tag only permits "phrasing content" within itself, and <ul> isn't considered phrasing content.
MDN definition of phrasing content: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Cont...
- Mikhail_Edoshin 6y agoThanks for the correction (I don't really know the HTML flow model and was guessing it.)