The World Wide Web Consortium (W3C) develops interoperable technologies (specifications, guidelines, software, and tools) to lead the Web to its full potential. W3C is a forum for information, commerce, communication, and collective understanding. On this page, you’ll find how to incorporate W3C Website guidelines in your website. I feel that we all should design our webpages in accordance with the Guidelines laid out by the governing body.
The following are some of the common errors which form a part of W3C XHTML Validations (see W3C Website Guidelines on W3C website). The following is an XHTML Validator Tutorial of sorts. You all can take a look at the same, and try to adapt it to your websites as well. You can validate your website at the W3C HTML Validator
Complaince to W3C Standards is legaly complusary in some countries including in the UK, the USA or else some one might sue you! You can use various Validators to validate your HTML files, however I would advice that you follow the original W3C Validtor.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The above declaration is a compulsory factor. Though, the declaration may vary according to your settings, it is always advised to follow the latest Declarations. The DOCTYPE declaration defines the code language, standard and enforcement level used for your HTML.
It is also an answer to question I asked anyone who claims to know HTML. In 99% of interviews I conducted, 99% of candidates have failed to answer the question – What is the first tag in HTML?
Obviously, the answer I get is HTML! People in India are thought nothing about it (or at least the ones I met). Some of the people are surprised to know that there is something known as DOCTYPE. Even in the book published by some prominent state education boards in India do not have any mention of DOCTYPE.
HTML Tag itself (<html>)
Obviously, the above declaration is a compulsory factor, and it is a no-brainer altogether. However, there are various types of HTML that needs to be defined.
Start tags for text and sub-tags
Text, or sub-tags (like input, select, img, a href etc.) should be in <div>*[text to be put inside paragraph tag <p>]<p> or <ul> <ol> <h1> etc.
End tags for all start tags are compulsory. it is also important that you have to end the tag at proper location. use <br />, <img src=”somefile” alt=”something” style=”border-width:0px; />”
<form name="frmsize" action="something" method="get">
A form tag has to contain the action=”someaction.aspx”
<div id="name" name="name" class="name_id">
Avoid using name=” name “ attribute
Underline Tag (<u>)
You have to remove it and avoid using it.
This element is used under the Select Tag. Well, here the only catch is <option></option> simply does not work for validation. If you want to have a blank one, then please put
Inserting Flash Objects can be tricky and would add to your woes when checking the document for your HTML document. It is better to use the following coding type which helps in attaining our goal of a completely Validated XHTML.
<object type="application/x-shockwave-flash data="c.swf?path=movie.swf" width="400" height="300"> <param name="movie" value="c.swf?path=movie.swf" /> <img src="noflash.gif" width="200" height="100" alt="" /> </object>
The solution for this comes from A List Apart article on the Embedding Flash While Supporting Standards
Close of Head tag, scripts and styles
The close head tag has to be proper and the style tag to be included in head tag along with script tags.
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
The above declaration helps the browser to understand the character set your webpage is using. It comes below the <html>. The character set can be changed according to the characters you are using in your webpage, most commonly used is iso-8859-1
Its also important to have all the elements in lower case. You should code <html> instead of <HTML>
Valign used in image tags, td/tr/table should be avoided. Instead use, “style:vertical-align:top;”
We have a strong habit to use the ALIGN element. Avoid using ALIGN and start using the CSS property
text-align:left; or right"style:vertical-align:top;"
Usage of border=”0″ is not allowed. instead use the style elements: style=”border-width:0px;” etc.
topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" marginheight="0"
Instead use the alternative style elements: style=”margin-left:0px; margin-right:0px;” etc.
target="_blank" Target="_top" target="_parent" target="_self"
The double quotes are important for specifying values/ i.e. values have to be like
[id="company"] [ alt="companyname-caption" ]
Ampersand in URIs / URLs
If you have to use ‘&’ in any URL (URI) please make special effort to make it &
ID & Name Attributes
<select class="text" id="selLanguage">
The id should be declared compulsorily)
<input type="hidden" name="Language" />
Necessary where ever an end tag in not specified.
alt is necessary for images. border not applicable. read [border=”0″] for more information