Wednesday, May 2, 2012

HTML Advanced tutorial 29 : XHTML Syntax Rules


While coding in XHTML, we must take care of following rules to avoid any error.

1.) Attribute Names Must Be In Lower Case :

<table WIDTH="100%">                     ( This is wrong way )

<table width="100%">                         ( This is correct way )

2.) Attribute Values Must Be Quoted :

<table width=100%>                           ( This is wrong way )

<table width="100%">                        ( This is correct way )

3.) Attribute Minimization Is Forbidden :

<input checked>                                  ( This is wrong way )
<input readonly>
<input disabled>

<input checked="checked" />               ( This is correct way )
<input readonly="readonly" />
<input disabled="disabled" />

4.) The Lang Attribute :
The lang attribute applies to almost every XHTML element. It specifies the language of the content within an element. If you use the lang attribute in an element, then you must also add the xml:lang attribute. For example

<div lang="en" xml:lang="en">Hello word!</div>

5.) Mandatory XHTML Elements :
Following elements are mendatory, in XHTML documents.

  • DOCTYPE declaration.
  • html, head, title, and body elements.

HTML Advanced tutorial 30 : XHTML Doctypes  >>
<<  HTML Advanced tutorial 28 : What is XHTML

No comments:

Post a Comment