K
The element <p> is categorized as https://html.spec.whatwg.org/multipage/dom.html#flow-content-2 and https://html.spec.whatwg.org/multipage/dom.html#palpable-content-2 , can therefore be used anywhere that is expected a flow element. Allows as child elements any element that is a https://html.spec.whatwg.org/multipage/dom.html#phrasing-content-2 .The definitions of each, in addition to the links mentioned, are in W3C, 3.2 Elements, 3.2.5 Contents, 3.2.5.1 Kinds of contents: https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#metadata-content-0 https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#flow-content-0 https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#sectioning-content-0 https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#heading-content-0 https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0 https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#embedded-content-0 https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#interactive-content-0 The relationship between the groups is:Source and version of the iterative image: https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#kinds-of-content Simplifiedly, phrase elements are the elements that define the content of the application or its formatting - it is worth highlighting the word formatting here, because formatting is not stylization (CSS applies styles).At the moment, the phrase elements are (links to the documentation you find https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0 a, abbr, area (if descended from a <map>), audio, b, bdi, bdo,
br, button, canvas, cite, code, date, datalist, del, dfn, em, embed,
i, iframe, img, input, ins, kbd, label, link (if allowed in
body), map, mark, MathML math, meta (if you own the attribute
itemprop), put, noscript, object, output, picture, progress, q,
ruby, s, samp, script, select, slot, small, span, strong, sub, sup,
svg, template, textarea, time, u, var, video, wbr, autonomous custom
elements and text.If other elements are added as children of <p>, it is possible that the element is closed before expected when the client processes the HTML structure, such as Rafael commented on https://pt.stackoverflow.com/a/313321/5878 .The specification explicitly cites, including, the example of defining lists within a paragraph, where it is not possible to use the elements <ol> and <ul> inside <p>.p > ul {
color: red;
}<p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</p>The HTML interpreted will be:<p></p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<p></p>
So much so that the CSS, which defines the red source for an element ul inside of a p it didn't work. In this case, the ideal is, as interpreted, to generate two distinct paragraphs, one before and the other after the list or to define the content within another element, as well as the div.<div>For instance, this fantastic sentence has bullets relating to
<ul>
<li>wizards,
<li>faster-than-light travel, and
<li>telepathy,
</ul>
and is further discussed below.</div>That will be interpreted exactly the way it is.