Thursday, July 2, 2009

Info on XHTML

XHTML (Extensible Hyper Text Markup Language): Its extended, cleaner and sticker version of HTML, almost identical to HTML4.0. It is based on XML application, so one can say its a combination of HTML and XML.

Basic difference between HTML and XHTML are:
  • XHTML elements must be properly nested.
  • XHTML elements must always be closed.
  • XHTML elements must be in lower case.
  • XHTML documents must have one root element.

XHTML syntax rules are:
  • Attribute names must be in lower case.
  • Attribute values must be quoted.
  • Attribute minimization is forbidden.
  • The id attribute replaces the name attribute.
  • The XHTML DTD defines mandatory elements :Doctype declaration, html,head and body tags are mandatory in XHTML documents.
Doctype specifies which DTD(Document type definition) is used by XHTML document. A DTD specifies the syntax of a web page in SGML. An XHTML DTD describes in precise, computer-readable language, the allowed syntax of XHTML markup.
There are 3 types of XHTML DTD
  1. XHTML 1.1 Strict :for clean markup and free of presentational clutter. It declared as: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. XHTML 1.1 Transitional : It is used when user want to use HTML presentational features. It declared as: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  3. XHTML 1.1 Frameset : When HTML frames are used. It declared as: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
After creating xhtml file and adding correct DTD, it can be validated using W3C Validator, using link

No comments:

Post a Comment