Jason Meridth

I am a continuously learning senior full stack SDE/SRE trying to not let best be the enemy of better.

Buy me a coffeeBuy me a coffee

Fix Rendering With Presence of Doctype

31 Mar 2013 » » html5, haml

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