JM (Jason Meridth)

JM (Jason Meridth)

Learn, Converse, Share

31 Mar 2013

Fix Rendering With Presence of Doctype

A couple times now I’ve forgotten to render the DOCTYPE in my layouts on my web apps. The DOCTYPE element tells the browser what type of file to expect. It needs to be the first line in your document, so it usually goes in your application layout file.

In HTML or ERB:

<!DOCTYPE html>

In HAML:

!!! 5

Other HAML Doctypes

The above is the format for HTML 5. I don’t bother with the HTML 4.01 DOCTYPEs