a DOCTYPE is all it takes

At a lunch conversation about quirks vs standards mode, the question was raised: but what if you don't have those kinda important tags such as <html> or <body>? is this going to be quirks mode?

Well, the following test case shows that a DOCTYPE is all it takes in order to have standards mode rendering. Was this a Cinderella song: "We all need a little DOCTYPE, just a little helper, ooh and it will be alright" :)

» Run test example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

hello

<script type="text/javascript">
alert("Quirks? " + document.compatMode);
</script>

This entry was posted on Friday, July 25th, 2008 and is filed under (x)HTML(5), browsers, standards. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


Get notification for future posts: follow me on Twitter or subscribe to my RSS feed

One Response to “a DOCTYPE is all it takes”

  1. imded3 Says:

    with HTML5 its just

Leave a Reply