Supported by :   My Law Forms Ltd. - Deed polls and Tenancy Agreements

What is a DOCTYPE?

This is….

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>

Ok so what? What’s it all for?

Well if you want to know the technical reasoning, see the link at the end… if you want to save yourself hours of stress and headaches when building webpages, then ….

The example above is a strict adherent to the HTML 4 standards from the W3C. This next option allows you to be a bit more forgiving in your HTML tag use, and allows deprecated tags.

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>

Ok so who cares?
Well at some point you will, though you might not realise it. If you want to save yourself hours of development time and numerous “Why the heck doesn’t that work?!?” moments, you should include a DOCTYPE in every webpage you write. You see without this initial tag, web browsers (Internet Explorer, Firefox, Opera, Netscape et al) will render your HTML using what is known as ‘Quirks Mode’. Now sometimes this helps make ‘broken’ HTML look ok, and sometimes it hides some common mistakes, but the problem is caused by inconsistencies in different browsers and browser versions. They all have slightly different quirks!

What looks lovely in YOUR browser, might look ugly in your visitor’s browser. What’s worse, it might not just be your design that suffers. Those fancy CSS, HTML or JavaScript effects you have on your page, that you think are so cool, just might not work at all on your visitor’s browser. This is compounded by the fact that ‘Quirks Mode’ is just that quirky.

One problem that this year struck thousands of webpages, is an issue with the inclusion of Flash (and other objects too) in webpages. An important security patch for Internet Explorer caused embeded objects to be surrounded by a bold border, and also to disable some functionality. All this resulted in many website owners angrily phoning their web design agency to demand the ugly border be removed.

Sticking to W3C standards won’t eliminate issues like this in the future, but it will help to reduce their effect on your wonderful design, and allow you to concentrate on the more important aspects of design and functionality.

Who needs a DOCTYPE? … Anyone who doesn’t need to alternative headaches!

Further reading…

To keep pace with developments it is advisable to use XHTML and make your webpages not just valid HTML, but also valid XML. You might not see a point to it now, but it will occur to you at some point in the future ;-) (had you heard of AJAX in 2003, it has been around that long!)

[Strict]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
[Loose]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

For more in depth technical details about DTD et al, start here…

Doctype

Quirks mode

This entry was posted on Monday, December 18th, 2006 at 3:32 pm and is filed under HTML help, XHTML tips. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.