webmaster resources free resources at triphp
Resources  •  Marketplace  •  Forums  •  Hosting  •  TriPHP Blog  •  Contact Us
spacer image


HTML-XHTML Syntax and Differences
by Ramil Alcibar

As what I’ve mentioned in the introduction, XHTML is almost identical to HTML. Well take a look on the following changes between HTML and XHTML listed below. As you can see, it seems very laborious task but the truth is you can even do it with some few clicks if you are using advance WYSWYG editors like Maromedia Dreamweaver MX and other webpage editing tools out there. In XHTML,

  • The is mandatory
  • All tags and attributes must be in lower case
  • All tags must be properly nested
  • Attributes must not be minimized and be properly quoted
  • All XHTML elements must be closed

The Is Mandatory
In HTML, the is optional, in XHTML it is mandatory and is the first line of a XHTML document. There are currently three XHTML document types; Strict, Transitional, and Frameset.

XHTML 1.0 Strict is used when the markup is very clean and there is no extra markup to aid the presentation of the document. Use this together with Cascading Style Sheets.


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

XHTML 1.0 Transitional should be used if you want to use presentational features of HTML and if you want to support older browsers that don’t support Cascading Style Sheets.


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

XHTML 1.0 Frameset is used if you divide your page into frames.


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

All Tags and Attributes Must Be In Lower Case
All XHTML tags and its attributes must be in lower case. This means that no letter/s in the tags/attributes must be capitalize or else it will violate this rule. Consider the following example below:


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">






This tag doesn't conform to lowercase requirements


What was wrong here was the first letter of the

tag. It should be in lower case. Consider also the following code which doesn’t conform to this rule.



Our mistake here is the capital letter of onClick. On HTML, such things are generally capitalize. Examples are onChange, onBlur, onKeyUp, onMouseOver, onMOuseOut, etc. These should be change to lowercase.


Source URL: http://www.triphp.com

About The Author
Ramil Alcibar is a contributor to TriPHP Webmaster Resources.