html - paragraph tag not closed? -
i simplified html code down this
<!doctype html> <body> <div class="index-div"> <p id="whoarewe"> <h2>who we?</h2> wersfgse </p> </div> </body> </html> however, when run , open page source, says "no p element in scope p end tag seen". runs fine strange reason, intellij idea , firefox both show unnecessary /p tag. computer glitching out?
there's fixed set of elements, belonging phrasing content category, can children of <p> element:
phrasing content text of document, elements mark text @ intra-paragraph level. runs of phrasing content form paragraphs.
a abbr area (if descendant of map element) audio b bdi bdo br button canvas cite code data datalist del dfn em embed iframe img input ins kbd keygen label map mark math meter noscript object output progress q ruby s samp script select small span strong sub sup svg template textarea time u var video wbr text
<h2> element, many other block-level ones, doesn't belong here. in case, <p> element closes automatically. quoting the docs:
a p element's end tag may omitted if p element followed
address,article,aside,blockquote,div,dl,fieldset,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,main,nav,ol,p,pre,section,table, orul, element, or if there no more content in parent element , parent element not element.
in particular case, structure of dom follows:
<p id="whoarewe"></p> <h2>who we?</h2> wersfgse </p> ... and, can see, end tag isn't welcome. actually, should grateful firefox dom inspector marking error. )

Comments
Post a Comment