DOCTYPE - HTML DOCUMENT DECLARATION !!

It is true to say that a large percentage of 'homepage-type' web-builders don't DECLARE at the start of their documents what version of HTML they are writing.

DOES IT REALLY MATTER ??

You will often hear the comment:-

"Does it matter ??" - - - - - - "It seems to work ok without it !!"

- or -

"Starting the page with just <html> instead of:-
        <?xml version="1.0"?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
seems a bit easier doesn't it".


Well - on the basis that you probably want to write the clearest and most understandable HTML you can - then yes it does matter.

It's also a fact that the newer version browsers actually read the document type that you declare and use it to interpret the html code you have written.

SO WHY DOES IT MATTER

To quote from an article at www.webreference.com:-

"DOCTYPE tags in HTML signify which standard the HTML follows, if any.
In the past, DOCTYPEs have not been that meaningful and many Web page authors and authoring tools use DOCTYPEs that do not match the actual HTML. Modern browsers such as NS6 and Internet Explorer 5 for the Mac sniff the DOCTYPE to determine whether an HTML page should be laid out according to the "Quirky" behavior of earlier browsers or if it should be laid out using the stricter modern standards."


Microsoft also explain at their Internet Explorer 6 CSS enhancements site that they too will have the new '!DOCTYPE sniffer' installed in the new IE6 version coming out soon

So - to précis all of the available information down to its basics. This means - as I understand it - that if you don't declare a doctype in future, then the modern browsers will switch you to the existing 'fudge as best you can mode' instead of interpreting the code to an exact and specified standard.

Now writing to an 'HTML Standard' isn't that difficult - you just choose the one you want and go for it.

THE HTML STANDARDS

You can read a bit about the HTML Standards history at 'W3C - An Introduction to HTML 4'.

I'll paraphrase the W3C article by merely saying that HTML has evolved from the outset, with each newer version allowing the author (you) to do more things on your page than before. The latest version you should aim at declaring is HTML4.01.

THERE ARE 3 'STANDARD' VARIATIONS

Taking HTML4.01 as an example - there a 3 variations allowed on that standard

These are HTML4.01 'Strict' ....... HTML 4.01 'Transitional' ........ and HTML4.01 'Frames'.
Excluding the 'FRAMES' variation - cos its best to avoid frames, but thats for another article - the difference between 'Strict' and 'Transitional' is basically as follows:-

HTML4.01 'Strict' specification means that all of your 'STYLE' and 'PRESENTATIONAL' commands are taken out of the HTML page and put into a stylesheet (or as style commands in your page header).

HTML4.01 'Transitional' specification means that all of your 'STYLE' and 'PRESENTATIONAL' commands can be left inside the HTML page. You'll find this version a lot easier while you are learning about Stylesheets. Go to W3C HTML4.01 Specification for a full list of all the commands you can use.

IS THE STANDARD EASY TO LEARN

In my personal view it really is easy to learn. In fact - most of you will be using the vast majority of valid HTML4.01 Transitional commands anyway - you just don't realise it.

If you already have a web page written with no declaration above the <html> tag, then just add the declaration
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
above it as the very 1st line of your page. Then go to the W3C Validator, insert you page URL - press the 'validate' button and it will generate a report for you you to read which will identify any html errors (or non conformity) to the standards you declare.

This means that by just concentrating on one error report at a time, you can actually use the validator to learn better html while 'cleaning' your page. The validator is a very good faulting tool at times.

CONVINCED YET ??

I hope these points have convinced you why its in your own interest to try and write to a 'standard' - whichever one you chose.

You will have the satisfaction of knowing its quality stuff you are writing and that all the browsers of the future will present your pages as they are meant to be seen.


If you are interested in GEORDIELAND then visit the site below.

Geordieland: Home of the Gods.

Home Page | Basement | Belarus | Wor Geordie | Handel | Search the Site | Site Map | Web Design | Email Me |

© Jimsky's Emporium 2004 - 2008.