i am dustin diaz

a JavaScriptr...

boosh.

don't worry about it.

The Skinny on Doctypes

Tuesday Nov 25 2008

Update: For the record, this is the standard forward compatible HTML 5 doctype. This should always work.
Doctypes have long been in standardista discussions circles. Why to use them. Which one to use. Which one is best. These are all <sarcasm>really fun details</sarcasm> to get into, but the most important aspect of any doctype is simply having one, since without one, you're stuck in the lovely world of "quirks mode". If you're interested in understanding the anatomy of a doctype, then by all means, dive in. At Google, we have this obsession with byte size. And by byte size, any "lack-therof" the better. Therefore the doctype you will find on most Google webpages while still triggering the browser into "standards mode" is as simple as you see below:

The skinny doctype

<!doctype html>
There is really, absolutely no reason you need the rest of the doctype in your declaration unless you're validating code. Furthermore, it does not mean that your page is even invalid. In the end, it puts your webpages into standards mode, which is what really matters. (Plus it's easy to memorize ;) Try it out. It will fix your box model in IE6 and clobber all those other funny gotchas when you're in quirks mode. Cheers.

Update: David was kind enough to share his results using the skinny doctype on his blog. The results, as expected, keep your browser tame.

this is who i am

Hi, my name is Dustin Diaz. Nice to meet you, too. I (actually) build products. Currently founder of an Expa-backed company. Previously @Change, @Medium, @Twitter, @Google, and @Yahoo. I wrote a book called Strobist® Info and was co-author of JavaScript Design Patterns. I co-created the Ender JavaScript Framework, I was an award-winning Photographer, and I pretend to be an amateur Mixologist. Pretend is fun. This is my website. Welcome!

On this site I (used to) write about JavaScript. You can also follow along with my open-source work on Github.

Last but not least, recruiters, you are very kind. I’m not looking for work. Cheers.