Why does content outside the body still display?

i have the folowing code and it shows both < p>'s even though ‘Duie Mragnea’ is outside the body and yet in your course you say “Only content inside the opening and closing body tags can be displayed to the screen”

< body>
< p> Muie Dragnea!< /p>
< /body>

< p>Duie Mragnea< /p>


I’m also having concerns on this one. It displayed the content though it’s outside the body.


@sant513 @ciellyberry @radu_moon no need to be concerned. The correct format for a document is:

<! DOCTYPE html>

               For title and links to scripts etc. 

                For content of the site e.g divs

If your code is laid out in any other way a browser isn’t guaranteed to display it correctly.

Browsers create DOMs (document object models) from your code, and if your code has tags outside of body or head this can mess up the model and create some weirdly rendered results.

However browsers assume users might do things a bit wrong, so if you have tags outside the body tag they might assume you should have put it in the body tags and process it as if you had done so. But the important thing is every browser does this differently, so if you’re format isn’t correct it could look different on every single browser. To guarantee your HTML is processed the same on every browser you should put tags you want displayed inside the body tag.


Same here I would also like to know this and it was said anything outside the body tag is not displayed but it seems to be working just fine. Text still displays outside of the body tag when type is there a reason for this?

If you want the technical answer, I don’t know. If you want the one that answers why simply compiles fine, the answers is above your comment.