Standards : a conceptual view.
A brief explanation of the reasons and need for a set of governing standards.
For those that are becoming aware of, but are somewhat confused by, the references they see to "Web Standards" and "Standards compliance"
As a brief potted history of the situation that led to the necessity for a governing set of standards, we need to look to the history of the browser and of coding.
It helps to understand that HTML/XHTML are essentially a scripting language and as such requires an interpreter of the script, software that will read the code and then attempt to render or display the instructions it finds. this is where the browser enters the picture as it is the mechanism by which this process happens and as no one owns the language anyone was free to produce their own browser.
The problem that arose was that given that the language was interpretable it was open to mis-interpretation and of being extended and added to. So - to be brief- we arrived at a situation whereby we had two main protagonists vying for the top spot in the browser market and creating there own sets of proprietary code that would only be understood by their browser; as in the "Blink" attribute in Netscape Navigator. Thus we have the beginning of a divergence of standards and which led to the situation that became known as the "browser wars" and the destructive legacy that we still have to live with today.
This in part was a catalyst for the need for a unifying set of standards as was the other fundamental aspect of the browsers which was that they would have built into the rendering engine the ability to cope with malformed code. in other words if you write bad code or code with errors such as missing closing tags, the browser will try to second guess what you intended and will attempt to display what it thought you meant. Now this may seem a helpful kindly act on the part of the browser until you realise that in reality all it actually achieves is the acceptance of ill structured incorrect code; if it displays, why worry how it's coded?
This led to the condition known as "Tag Soup Code" that is code that will work but is fundamentally flawed and which relies on the browsers ability to guess at the display and is impossible for anyone but the original author to understand.
To return to the subject of "Standards" it fell to someone to provide a common set of specifications that could be followed; this task fell to the W3C(W3C mission statement)which acts as the governing body for "Web Standards" and with it's members, drawn from the major interested parties, through working groups, defines the specifications and recommendations to be followed such as HTML4.01 and CSS 2 to name but two
Another reason that the need for a common "standard" became apparent was the fact that hopefully by following a proscribed method of coding it would be possible- as long as the core specification remained intact- that as the "Standard" Evolved, pages written would still be able to be read regardless of the changes and that they should be able to display in any future devices and any browser; although this remains a slightly contentious issue, with some being sceptical that browsers will indeed conform to the agreed specifications, as I see it I can see no reason that browsers should wander away from the specs though.
So in modern browsers, that is browsers that agree to follow the specifications, the ability was built in to them to be able to switch between two different methods of rendering a pages code. These are known as "quirks Mode" and "Standards compliance Mode" (for further detail on these two modes this article by Quirksmode.org is useful)
Quirks mode allows the browsers to render according to the old rules but if the browser sees a DTD (Document Type Declaration- valid W3C DTD's) it will switch into "compliant Mode" and display the page according to the specifications laid out by the W3C.
What do we achieve in using Standards then? well for a start we know that the code we use, be it CSS or HTML/XHTML will display as far as possible according to a common set of rules and we can make considered judgements as to why something may not be working as expected, due to the fact that we have this set of behaviors laid out in the specifications; on the other hand when presented with a page that has no DTD and is rendering in Quirks mode it becomes much harder to attempt to offer help due to the differences the browsers will exhibit in displaying code in Quirks mode.
To round up now more than ever there seems little reason not use "Standards Mode" and every reason to use it.
In the long run it simplifies our lives and brings unity and order to something that was becoming chaotic and imposes no undue restrictions on us nor is it something that we should view as difficult to implement.
For the future it should mean the continued safe evolution of code that will hopefully always be both forward and backwards compatible.
Update: 22/03/05:
DOCTYPE switching guides; selecting a DTD
Here is a quick guide to standards switching with particular DOCTYPES along with links to the full specs for Mozilla, IE6, Opera.
DTD standards switching: 'on'= Standards Mode ~ 'off'= Quirks Mode
'Definitions'= strict, transitional, frameset.
Mozilla DOCTYPE guide to standards switching:
Mozilla guide to DOCTYPES
(Authors note: the details on the Mozilla specs are confusing and it is not clear what roll the url plays)
Full Standards Mode is 'on' if;
DOCTYPE is:
Declared without DTD i.e <!DOCTYPE HTML>.
Declared without definition and url i.e <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
Declared as html 4.01, strict definition, with url. ( this is a leap of faith as it isn't clear, but must be the case.)
Declared as xhtml, strict definition; without url. (assuming with url as well, although again not clear.)
Mozilla 'Almost Standards Mode'
'Almost Standards mode' applies to:
html 4.01 Doctypes which are defined as transitional or frameset, and as far as can be determined with a url.
xhtml 1.0 transitional, without or without a url.
Quirks Mode is triggered if:
No DOCTYPE.
html 4.0 transitional, frameset with or without a url
html 4.01 transitional, frameset, without a url.
( Thankyou Mozilla for making this clear as mud )
IE DOCTYPE guide to standards switching:
IE guide to DOCTYPES
html 4.0 - with no definition; with or without url: switching is on
html 4.0 - transitional definition; no url: switching off
html 4.0 - strict definition; with or without url: switching is on
xhtml - any definition; with or without url : switching is on (as long as no xml prolog present)
(Authors Note: the assumption is made that this applies to 4.01 as no mention is made otherwise.)
Opera DOCTYPE guide to Standards switching:
Opera guide to DOCTYPES
html 4.0 transitional definition; without url: switching off
html 4.0 transitional definition; with url: switching on
html 4.0 strict definition; with or without url: switching on
(Authors Note: the assumption is made that this applies to 4.01 as no mention is made otherwise.)
xhtml - any definition; with or without url : switching is on (as long as no xml prolog present)
N.B from Opera 7.1 xml prolog is ignored for rendering mode .
Which to use ?:
The safest conclussion I can draw from this is that if you wish to be switching into full standards mode ( and we all should) then using a ''strict' definition along with url (system identifier) is required , this should prove the safest bet, with most browsers.
------------------------------
This is a general guide and not exhaustive, there may well be errors and omissions.
So before anything else select your preferred DTD and join the world of Standards.
For further reading these links may be useful:
The Web Standards Project
Web Standards Checklist
The Benefits of Web Standards
About Web Standards
Using Web Standards in Your Web pages
Hugo.