navigation
Thomas Brunt's OutFront Hosting
 
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Microsoft MVP
 

Are You Compliant?  Part I  
by Outfront Moderator Katherine Nolan (abbeyvet)
OutFront News Article: July, 2002

Most of us spend some considerable time during the design of our sites repeatedly viewing them in an increasing array of different browsers and browser versions to ensure that they look 'right' in all. Some have been tempted to take the view that, with its current domination of the market, that the only browser that really matters is Internet Explorer.

Wouldn't it be wonderful if we could just create a site and know that it would appear the same in all browsers? Why is this not the case? Whose fault is it? What can we do to improve the situation?

Standards Compliant and Proprietary Code

When you create something, be it in HTML, JavaScript or whatever, that works beautifully on one browser and not on another the temptation is to blame the browser. More often than not however the problem occurs because of the use of proprietary code. Proprietary code is code that one or other browser is designed to support without regard for standards, it is not standards compliant code.

The fact that one browser manufacturer has decided to include support for something that is not part of any generally recognised standard does not mean that browsers not supporting that code are rubbish. If you decide to use something that is proprietary rather than standard you can expect browser conflicts. 

Who sets the standards?

Standards are set by the World Wide Web Consortium (W3C) which comprises member organisations from around the world and sets a series of standards for various types of code and technologies. However while widely recognised as the standard setter for the web, the WC3 has no statutory basis and compliance with its standards is not compulsory. 

In this article we are really just looking at HTML, its current standards and where the future is likely to be. The latest defined standard is for HTML 4.01, there is a link to more detailed information about it at the end of this article.

Current Standards

HTML 4.0 And CSS

The latest standard of HTML is HTML 4.01. Not only is it the latest standard, it will probably be the last standard ever defined for HTML. In essence HTML can be considered 'finished'. Not finished as in over, but as in complete.

HTML was originally intended simply as a way to display information, it was never intended to be used as a means to design and layout elaborate web pages. HTML 4 was an attempt to get back to this situation by removing the control of the information's appearance out of the specification. 

Example

An example of what this means and why it matters is the <font> tag. This was not part of any specification but was introduced by Netscape, with various attributes such as 'size=' and 'color=' which allowed it to be used to change the appearance of text on the page. It was quickly taken up by Microsoft also and they introduced the face= attribute. The possibility for design of web pages, on the face of it, seemed fantastic!

But there were problems. The original purpose of HTML was less well fulfilled and the issue of cross browser compatibility was born. 

Various browser versions recognised, or failed to recognise, the new attributes; text only browsers, not uncommon at the time, didn't see any variation in the way the text was displayed since they did not recognise the font tag. Using the font face attribute only worked where someone had the font installed, they only saw the color you specified if their computer or monitor was capable of displaying it and so on.

It also presents a nightmare when a site needs to be altered. If each individual font tag on each page of a site must be changed this can be a gargantuan task.

HTML 4 removed the font tag from the specification and required that CSS or style sheets be used to control the appearance of content. This, along with other changes, was designed to get back to HTML's roots and to once again make it a means of organizing information rather than of displaying it. With HTML 4 and CSS changing the site's appearance is as easy as making a change to a single file - the CSS file.

More about HTML 4 and CSS

Future Standards

Following on from HTML 4 has been the development of two new standards - XML and XHTML. These have been the buzz words of recent times and they are very important developments. However for now we are going to stick with HTML 4 and in a later article will look at these developments. 

For any move towards using these new standards it is necessary to become comfortable with HTML 4 and CSS, how they work together and with the more important aspects of writing compliant code. That is where we will concentrate attention for now.

Why should you be standards compliant?

There are altruistic reasons for this but also some purely selfish ones!

If the nirvana of all browsers rendering code the same is to be reached, then there needs to be a standardization of code. Without it that aim is impossible. If those of us actually creating web pages do not support the standards they cease to have any meaning. By supporting them we advance the cause of standardization and allow new standards to be introduced and implemented in a smooth manner.

On a selfish level, by adhering to standards we are less likely to find ourselves, a couple of years down the line, with sites that no longer work in newer, more compliant, browsers. 

While there were a lot of problems with the initial release of NN 6, many of the problems with sites that were blamed on that browser were due to the fact that is was a more rigidly standards compliant browser than any before it. Thus many of the little 'workarounds' and tricks that had been adopted to force things to be cross browser compatible in the past failed in it. The result was a browser that failed, since so many sites didn't work in it. A reflection not totally of the browser but of the failure of so many sites to comply with the standards.

IE has tended to be much looser in its support of standards. That is not to say that they are not supported, they are and in many cases more completely than in its opponents. However newer versions have also tended to remain backward compatible and have continued to support proprietary and other code that was never part of any standard. This serves to perpetuate the use of non compliant code. While in the short term this may be helpful, in the long term it is not. Backwards compatibility cannot go on forever.

What Standard to Comply With?

The first decision you must make is the standard to which you will comply and how strictly you will comply with it. Then you must announce your decision to the world, or more specifically to the browsers. In other words your pages should have a Document Type Definition (DTD).

The DTD should be the first line of any HTML document, it tells the browser the what standard of HTML is used by the page and therefore how it should be displayed. Many of you probably have no such definition on your pages, I know I don't on many of mine, and the pages display just fine - so why bother with it?

Well, you have three choices on how you approach the DTD, each with consequences.

a. Ignore its existence and leave it out
Currently most browsers will assume that a page with no DTD is using old, invalid, possibly buggy code and will thus render it as older browsers would have. This is good because it ensures backward compatibility for the present at least. It is bad because certain things, particularly some newer CSS standards, will just not work.

b. Specify a 'loose' compliance with standards
eg: 

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

or

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

You will away with less than perfect code but again will lose out on the advantages that strict compliance can bring. 

In the first example your code should comply with the definition at the URL specified, a transitional standard, so a certain level of interpretation of standards is applied. This is an OK compromise for the moment, but there is no reason to believe that transitional standards will continue to be supported in the future so it should not be looked on as equivalent to strict compliance.

In the second a much more vague interpretation is implied and it is little different than leaving it out altogether.

c. Specify Strict Compliance

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

You can decide you will comply fully with a standard and specify this standard in your DTD.

Links

HTML 4

The full specification

Learn CSS

The W3C Schools pages are packed with information and good tutorials.

There is also an introductory tutorial here at OutFront

DTD

A more detailed explanation of the various options and their implications

Next week we will take a closer look at how well browsers currently deal with these standards and at what the standard means when it comes to writing your HTML, or to controlling and correcting the HTML written by your favorite editor.

PS: Please don't look at the code for this page - it is definitely not compliant!!! :)

>> Part II - How to become Compliant


 

Fun With Background Images
Fun With Bulleted Lists
Are You Compliant?
Introduction To Cascading Style Sheets
Creating Custom Error Pages
Designing Fast Loading Sites
Creating Funky Forms With CSS
htaccess Magic
An Introduction To JavaScript
JavaScript Snippets
Getting More From Mailto
Installing And Using Perl Scripts
Preparing Photos For Your Web Site
The Popup Dilemma
Paint Shop Pro Album 4
Creating And Using robots.txt File
Creating JavaScript Rollover Buttons
 

Microsoft Corporation in no way endorses or is affiliated with "OutFront." 
OutFront is published and edited by Thomas Brunt
440 Great Circle Dr., St. Matthews, SC 29135.  803-655-6151
© 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 All Rights Reserved
Click here to view our privacy statement.