What content can be outside head and body tags?

流过昼夜 提交于 2020-01-19 16:25:45

问题


This may seem like a weird question, but i'm building some script that reads HTML files and i'm dividing the content to 2, body and head and was wondering if there could be other content i might not know of?

The only thing i know of is <DOCTYPE> and i was wondering if there could be more?


回答1:


The doctype declaration isn't exactly content in the sense of the word.

There isn't any content that is supposed to exist outside head and body (and in fact, any content that's meant to display should only exist inside body). Browsers can create some pretty wacky DOMs when you give them strange or invalid markup, however. Here's an example.

Also, head and body, in that order, are the only two possible children of html, the root element.



来源:https://stackoverflow.com/questions/13470854/what-content-can-be-outside-head-and-body-tags

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!