Top Tips to Validate XHTML

by Neerav Bhatt on September 12, 2004 · 2 comments in Topic: Webdev & SEO

When validating XHTML markup with the W3C Validator, there are a few easy ways to quickly reduce the number of errors it finds:

  1. Specify a DOCTYPE
  2. Specify the Character Encoding
  3. Write all HTML tags and Attribute Names in lower case eg: use table not TABLE and use height=”1″ not HEIGHT=”1″
  4. Encode HTML character entities like the ampersand character & properly, always use & in place of &
  5. Quote all attribute values even those that are numeric eg: use <td rowspan=”3″> not <td rowspan=3>
  6. Empty tags like <hr> and <br> must be replaced with <hr /> and <br />. Note: older versions of Netscape cant interprete the <br/>
    tags. Typing a space before the / in <br /> fixes this problem.

2 comments



click here

{ 2 comments… read them below or add one }

1 Sebastian Green September 18, 2004 at 9:51 am

Nice getting started tip, w3c own refrence isnt to sharp all the time.

2 mtajim March 4, 2008 at 4:53 am

validating a xhtml script can sometime becomes tiresome. I have found that most people simply code first and never care for validation.

Leave a Comment

Previous post:

Next post: