XHTML Standard Syntax _css/html

Source: Internet
Author: User
Tags closing tag compact deprecated
Writing XHTML requires the use of clean HTML syntax






--------------------------------------------------------------------------------



Some more XHTML Syntax Rules:
More XHTML Syntax rules:
Attribute names must is in lower case
Property name must be lowercase
Attribute values must be quoted
Attribute values use double quotation marks
Attribute minimization is forbidden
Attribute shorthand is not allowed
The id attribute replaces the name attribute
Replace the Name property with the id attribute
The XHTML DTD defines mandatory elements
XHTML DTD Definition Enforcement elements



--------------------------------------------------------------------------------



Attribute Names must is in Lower case
Property name must be lowercase
This is wrong:
This is wrong:












This is correct: it is correct:





--------------------------------------------------------------------------------



Attribute Values must be Quoted
Attribute values must be enclosed in double quotation marks
This is wrong:
This is wrong:












This is correct: it is correct:





--------------------------------------------------------------------------------



Attribute minimization is Forbidden
Attribute shorthand is not allowed
This is wrong:
This is wrong:







This is correct:
The correct is this:







Here are a list of the minimized attributes in HTML and how they should are written in XHTML:
This is a shorthand attribute in HTML and a list of how it should be written in XHTML:



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 ID Attribute replaces the name Attribute
ID attribute Replace Name property
HTML 4.01 defines a name attribute for the elements a, applet, frame, iframe, IMG, and map. In XHTML, the name attribute is deprecated. Use ID instead.
A name attribute is defined for a, applet, frame, iframe, IMG, and map,html 4.01, which is deprecated in XHTML, using an ID instead.



This is wrong:
This is wrong:



This is correct:
That's right:



Note:to interoperate with older browsers for a while, your should use both name and ID, with identical attribute values, l Ike this:
Note: In order to have a lower version of the browser, you should use both the name and ID attributes, and make them two values of the same, like this:



IMPORTANT Compatibility Note:
Compatibility Note points:



To make your XHTML compatible with today's browsers, you should add a extra space before the "/" symbol.
Make your XHTML compatible with your current browser you should add a space before the/tag




--------------------------------------------------------------------------------



The Lang Attribute
Lang Property
The lang attribute applies to almost every XHTML element. IT Specifies the language of the content within an element.
The lang attribute can be applied to almost all XHTML elements. It specifies the language of the content in the element



If you use the lang attribute in a element, you must add the Xml:lang attribute, like this:
If you apply the lang attribute like in an element, you must add the Xml:lang attribute, like this:



Heia norge!



--------------------------------------------------------------------------------



Mandatory XHTML Elements
Forcing XHTML elements
All XHTML documents must has a DOCTYPE declaration. The HTML, head and body elements must is present, and the title must be present inside the head element.
All XHTML documents must have a DOCTYPE reputation. The HTML, head, and body elements must appear, and the title must be in the HEAD element



This is a minimum XHTML document template:
This is a minimal XHTML document template






Title goes here

Body text goes here
Note:the DOCTYPE Declaration is a part of the XHTML document itself. It is a no XHTML element, and it should not has a closing tag.
Note: The DOCTYPE declaration is not part of the XHTML document itself. It is also not an XHTML element, it should not have a close tag.



Note:the xmlns attribute inside the tag is required in XHTML. However, the validator on w3.org does "not" complain when this attribute was missing in an XHTML document. This was because "xmlns=http://www.w3.org/1999/xhtml" is a fixed value and would be added to the tag even if you don't Inc Lude it.
Note: The XHTML document requires that the xmlns attribute appear in the HTML tag. However, the W3.org validator does not report an error because this property does not appear in your XHTML document. This is because "xmlns=http://www.w3.org/1999/xhtml" is a fixed value, even if it is not included in your document, it will be added automatically.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.