The Importance of the Doctype Tag

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

All currently popular browsers support at least CSS1 and most support at least CSS 2.1. This unfortunately means that there are some CSS commands that will not be correctly processed in all browsers. This means that you may need to make minor modifications to your CSS to correct for older browsers that do not understand all of your CSS properly. Depending on how popular the browser is you may want to apply a hack to get your page to look identically in that browser to the way it looks in other browsers or you may just settle for the page looking reasonable even though it uses a simpler layout than it does in browsers that support the more modern standard. Even if you are going to do this your job will still be much easier of you start off with a doctype at the start of your HTML file, write your HTML and CSS following the standards, and then make the minor modifications needed to your CSS to get the page to look reasonable in older browsers.

Why use a strict rather than a transitional doctype? Because the transitional doctype is intended to be used as a transition stage for old web pages that you have partly updated to the current standards. You should only use a transitional doctype for old web pages that were written back before the doctype tag started to be used as a switch. Adding that doctype is the first step in updating the page to meet the current standards and allows you to combine the new standards into a page that still has some code that used the old pre 1999 ways of specifying how the page should look.

Why use HTML 4.01 rather than HTML 3.2, HTML 5, or XHTML? Well the HTML 3.2 standard predates 1999 and was superseded in 1999 by the HTML 4.01 standard. The HTML5 standard is still at an early draft stage and will probably not be ready for release until at least 2015 if not much later by the time it is worked out which new tags are actually worth adding. As for XHTML the XHTML 1.0 standard was developed at the same time as HTML 4.01 and is a conversion of HTML into an XML compliant language. This would be usable for creating web pages if all browsers supported XHTML but unfortunately IE8 and earlier do not support it and there is no indication that IE9 will support it either. While IE remains a significant browser it is not practical to use XHTML instead of HTML for web pages.

 

This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow
Donate