- What does a
doctype
do?
doctype
lets the browser know how to read your HTML. You should put it at the beginning of every HTML page. For HTML5, it looks like <!DOCTYPE html>
(though in earlier versions of HTML it was more verbose).
If you don't use it on an HTML page, then different browsers will incorrectly read your HTML in different ways (for example, Internet Explorer will differ from Opera, which will also differ from Firefox).
By including the doctype
at the top of the page, the browser can correctly parse the HTML, and the look of the page will be more predictable across browsers.