The implementation of valid/standard methods, guidelines and best practices will help to produce high quality websites that are accessible to as many as possible. By building valid websites you can save time and money for the development and provides a better experience for the visitor.
Validation is also an important part of web development. Many errors that are hard to find can discover during validation. This is like spell checking and proofreading for grammar and syntax in a document. but is much more precise and reliable than any of those processes because it is dealing with precisely-specified machine languages, not with nebulously-defined human natural language. You can validate your (X)HTML page as well as your CSS.
Here I’m not going brief you about Web Standards, but I’m going to tell how we can use those best practices in Web standards to produce a valid (X)HTML page.
DOCTYPE declaration at the beginning of the file. A DOCTYPE (short for “document type declaration”) informs the validator which version of (X)HTML you’re using, and must appear at the very top of every web page. DOCTYPEs are a key component of compliant web pages: your markup and CSS won’t validate without them.<!DOCTYPE html PUBLIC "- //W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />xmlns="http://www.w3.org/1999/xhtml" to the <html> element.</p> is not valid anymore.<P> becomes <p>.<hr> becomes <hr />.<p align="right">.<hr noshade="noshade" />.& in place of &. : <a href="foo.php?chapter=1&section=2 /><form> element should have to have a action attribute always: <form action="#"name & id attributes in input element, both should be in same name: <input name="field_name" id="field_name" />alt attribute always for <img> element: <img src="image.gif" alt="" />width & height attributes as in this order in <img> element: <img src="image.gif" width="100" height="100" alt="" /><script type="text/javascript" src="javascript.js"></script>tables only for TABULAR data.<th> for table headers & <td> for table data.<strong><em>…</em></strong>Here i’m going to list some useful browser specific CSS selectors, known as browser specific hacks;
IE 6 and below: * html {}
IE 7 and below: *:first-child+html {} * html {}
IE 7 only : *:first-child+html {}
IE 7 and modern browsers only: html>body {}
Modern browsers but NOT IE7: html>/**/body {}
Opera 9 and below: html:first-child {}
Safari: html[xmlns*=""] body:last-child {}
Check this tutoaial to learn how to use CSS selectors »