This is wrong:
ÕâÊÇ´íÎóµÄ£º
| 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" |
HTML 4.01 defines a name attribute for the elements a, applet, , i, img, and map. In XHTML the name attribute is deprecated. Use id instead.
¶ÔÓÚa, applet, , i, imgºÍmap£¬HTML 4.01Öж¨ÒåÁËÒ»¸önameÊôÐÔ£¬ÔÚXHTMLÖÐÊDz»ÔÞ³ÉÕâÑù×öµÄ£¬Ê¹ÓÃidÀ´´úÌæ¡£
This is wrong:
ÕâÊÇ´íÎóµÄ£º
This is correct:
ÕâÊÇÕýÈ·µÄ£º
Note: To interoperate with older browsers for a while, you should use both name and id, with identical attribute s, like this:
×¢Ò⣺ΪÁ˰汾±È½ÏµÍµÄä¯ÀÀÆ÷£¬ÄãÓ¦¸ÃͬʱʹÓÃnameºÍidÊôÐÔ£¬²¢Ê¹ËüÃÇÁ½¸öµÄÖµÏàͬµÄ£¬ÏñÕâÑù£º
IMPORTANT Compatibility Note:
¼æÈÝÐÔ×¢Òâµã£º
To make your XHTML compatible with today''s browsers, you should add an extra space before the "/" symbol.
ÈÃÄãµÄXHTML¼æÈݵ±Ç°µÄä¯ÀÀÆ÷ÄãÓ¦¸ÃÔÚ/±ê¼ÇǰÌí¼Ó¿Õ¸ñ
The lang attribute applies to almost every XHTML element. It specifies the language of the content within an element.
langÊôÐÔ¿ÉÒÔÓ¦ÓÃÓÚ¼¸ºõËùÓеÄXHTMLÔªËØ¡£ËüÖ¸¶¨ÁËÔªËØÖÐÄÚÈݵÄÓïÑÔ
If you use the lang attribute in an element, you must add the xml;lang attribute, like this:
Èç¹ûÄãÏñÔÚÒ»¸öÔªËØÖÐÓ¦ÓÃlangÊôÐÔ£¬Äã±ØÐë¼ÓÉÏxml:langÊôÐÔ£¬ÏñÕâÑù£º
Heia Norge!
All XHTML documents must have a DOCTYPE declaration. The html, head and body elements must be present, and the title must be present inside the head element.
ËùÓеÄXHTMLÎĵµ¶¼±ØÐëÓÐÒ»¸öDOCTYPEÉùÃû¡£html¡¢headºÍbodyÔªËØ±ØÐë³öÏÖ£¬²¢ÇÒtitle±ØÐëÔÚheadÔªËØÀï
This is a minimum XHTML document template:
ÕâÊÇÒ»¸ö¼«Ð¡µÄXHTMLÎĵµÄ£°å
Body text goes here
Note: The DOCTYPE declaration is not a part of the XHTML document itself. It is not an XHTML element, and it should not have a closing tag.
×¢Ò⣺DOCTYPEÉùÃ÷²¢²»ÊÇXHTMLÎĵµ×ÔÉíµÄÒ»²¿·Ö¡£ËüÒ²²»ÊÇXHTMLÔªËØ£¬Ëü²»¸ÃÓйرձêÇ©¡£
Note: The xmlns attribute inside the tag is required in XHTML. However, the validator on w3.org does not complain when this attribute is missing in an XHTML This is because "xmlns=http://www.w3.org/1999/xhtml" is a fixed and will be added to the tag even if you do not include it.
×¢Ò⣺XHTMLÎĵµÒªÇóxmlnsÊôÐÔ³öÏÖÔÚhtml±êÇ©ÖС£È»¶ø£¬w3.orgµÄУÑéÆ÷²»»áÓÉÓÚÕâ¸öÊôÐÔûÓгöÏÖÔÚÄãµÄXHTMLÎĵµÖжø±¨¸æ´íÎó¡£ÕâÊÇÒòΪ"xmlns=http://www.w3.org/1999/xhtml"ÊÇÒ»¸ö¹Ì¶¨µÄÖµ£¬¼´Ê¹ÄãµÄÎĵµÀïûÓаüº¬Ëü£¬ËüÒ²»á×Ô¶¯¼ÓÉϵġ£
¹Ø±Õ´°¿Ú À´Ô´:ÍøÂç 16 2007-05-14