W3C Validation Tips and Best Practices

by Hiroshi on September 6, 2008

in standards, W3C

Markup language validation is very important. Without it your web page will not be indexed in Google. Google crawlers will just avoid the invalid markup and errors in HTML. Here is a complete list of tips you can use to avoid HTML markup errors and warnings so that you write valid HTML or XHTML.

Advices For Valid Markup
  • Use (define) backgrounds in CSS, not in html, TD, TR or Table
  • Do not define height of table or tr
  • Use alt=”” at every image even at spacer and separator
  • Place form tag b4 and after table tag and not td
  • Use correct doctype i.e.
  • Use all attributes for tags, i.e. script tags and css link tags. i.e.

  • In Anchor link where u have to use & use its code like &
Advices For Valid CSS
  • Define background color with color, and for transparent use inherit i.e.
    color : #000000;
    background-color: inherit;
    Use these both even one is not necessary to define, second with inherit property
  • Use shorthand for properties
  • Use generic font family i.e.
    font-family : verdana, arial, sans-serif;
    or
    font-family : “trebuchet ms”, geneva, sans-serif;
  • For background and backgriund position use different lines. i.e.
    background: url(../images/menulinebg.jpg) no-repeat;
    background-position:left center;
Validate HTML, XHTML and CSS

W3C HTML Validator

http://validator.w3.org

CSS Validator

http://jigsaw.w3.org/css-validator/

Related Posts

Previous post:

Next post: