Write XHTML code to need pure HTML grammar.
More XHTML grammar are regular:
Attribute name must the ordinary form of a Chinese numeral
Property value must add quote
Attribute cannot logogram
The attribute that use Id replaces Name attribute
XHTML DTD defined the HTML element of requisition
Attribute name must the ordinary form of a Chinese numeral
This is wrong:
<table WIDTH= "100% ">
This is correct:
<table Width= "100% ">
Property value must add quote
This is wrong:
<table Width=100%>
This is correct:
<table Width= "100%" >
Attribute cannot logogram
This is wrong:
| It is quotative content below: <input Checked> <input Readonly> <input Disabled> <option Selected> <frame Noresize> |
This is correct:
| It is quotative content below: <input Checked= "checked" /> <input Readonly= "readonly" /> <input Disabled= "disabled" /> <option Selected= "selected" /> <frame Noresize= "noresize" /> |
The logogram attribute list of a HTML is below, and adapt mediumly in XHTML:
| It is quotative content below: HTML XHTML Compact Compact= “compact ” Checked Checked= “checked ” Declare Declare= “declare ” Readonly Readonly= “readonly ” Disabled Disabled= “disabled ” Selected Selected= “selected ” Defer Defer= “defer ” Ismap Ismap= “ismap ” Nohref Nohref= “nohref ” Noshade Noshade= “noshade ” Nowrap Nowrap= “nowrap ” Multiple Multiple= “multiple ” Noresize Noresize= “noresize ” |
The attribute that use Id replaces Name attribute
HTML 4.01 defines Name attribute in the light of following element: A, applet, frame, iframe, img, with Map.
Do not encourage use Name attribute in XHTML, should use Id to replace.
This is wrong:
<img Src= "picture.gif" Name= "picture1" />
This is correct:
<img Src= "picture.gif" Id= "picture1" />
Important compatibility hints:
You should add an extra blank space before “/” symbol, in order to make your XHTML and current browser phase compatible.
Language attribute (Lang)
Lang attribute applies at almost all XHTML elements. The place of the content that it defines elemental interior uses the type of the language.
If Lang property is used in some element, must add additional Xml:lAng, resemble such:
<div Lang= "no" Xml:lAng= "no" >Heia Norge! </div>
The XHTML element of requisition
All XHTML documentation must state into travel file type (DOCTYPE Declaration) . Must put in element of Html, Head, Body in XHTML documentation, and Title element must be located in in Head element.
It is below the smallest the XHTML file pattern plate that change:
| It is quotative content below: < ! DOCTYPE Doctype Goes Here> <html Xmlns= "Http://www.w3.org/1999/xhtml "> <head> <title>Title Goes Here</title> </head> <body> </body> </html> |
Clew: File type statement is not the component of XHTML documentation oneself. It is not element of a XHTML, also did not shut label.
Clew: In XHTML, the Xmlns attribute inside <html> label is indispensible. However, when there is this attribute in documentation of even when XHTML, the tool of test and verify of W3.org also won’t hint mistake. Because,this is, “Xmlns=http://www.w3.org/1999/xhtml” is a fixed cost, although you did not include it in code, this value also can be added in <html> label.
You are issueing one chapter to learn the knowledge that more states about XHTML documentation type.
Bookmark:Digg Del.icio.us Reddit
