Why you should put doctype html at the top of your document

If you create the following html document:

It will render like this.


If you add <!doctype html> to the top of your document like this:

It will render like this.


What happens is that browsers such as firefox will think that you are viewing an old website so they will try and render websites how they used to be rendered. This old way of rendering is called “Quirks mode”. Adding <!doctype html> signifies that you are writing a modern webpage so the browser does not render using quirks mode.

Leave a Reply

Your email address will not be published. Required fields are marked *