HTML and CSS Reference
Introduce a Root Element
Make sure every document has an html root element.
XML requires every document to have a single root element. XHTML requires that this element be html .
Browsers interpret html -less (and headless and bodyless) documents differently. Adding the proper root
element will synchronize their behavior.
Search for documents that don't contain <html . Because of DOCTYPE declarations, comments, whitespace, and
byte order marks, this often isn't exactly the first thing in the document, but it's usually pretty near the start.
It's very unusual to find this string in any document that doesn't have an html root element.
This problem isn't a common one, but I have seen it more frequently than I'd expect. Fixing it is
straightforward: Just put <html> at the start (though after the DOCTYPE) and </html> at the end.
Documents that are missing html tags are often missing head and/or body elements, too. You may need to add
these as well. The head is not technically required, but you really want to have one with at least a title. The
body element is required if you have any content at all: text, paragraphs, tables, anything.