XHTML standard syntax _ CSS/HTML

Source: Internet
Author: User
The standard XHTML syntax for writing XHTML requires the use of clean HTML syntax


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

Some More XHTML Syntax Rules:
More XHTML syntax rules:
Attribute names must be in lower case
The property name must be in lowercase.
Attribute values must be quoted
Double quotation marks are used for attribute values.
Attribute minimization is forbidden
Attribute abbreviations are not allowed.
The id attribute replaces the name attribute
Replace the name attribute with the id attribute
The xhtml dtd defines mandatory elements
Xhtml dtd definition force element

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

Attribute Names Must Be In Lower Case
The property name must be in lowercase.
This is wrong:
This is incorrect:


This is correct:This is correct:

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

Attribute Values Must Be Quoted
The attribute value must contain double quotation marks.
This is wrong:
This is incorrect:


This is correct:This is correct:

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

Attribute Minimization Is Forbidden
Attribute abbreviations are not allowed.
This is wrong:
This is incorrect:





This is correct:
Correct:





Here is a list of the minimized attributes in HTML and how they shocould be written in XHTML:
This is a simplified attribute in HTML and a list of how to write it in XHTML:

HTML XHTML
Compact = "compact"
Checked = "checked"
Declare = "declare"
Readonly = "readonly"
Disabled = "disabled"
Selected = "selected"
Defer = "defer"
Ismap = "ismap"
Nohref = "nohref"
Noshade = "noshade"
Nowrap = "nowrap"
Multiple = "multiple"
Noresize = "noresize"


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

The id Attribute Replaces The name Attribute
Replace the name property with the id 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.
For a, applet, frame, iframe, img, map, and HTML 4.01, a name attribute is defined. In XHTML, this attribute is not supported and is replaced by id.

This is wrong:
This is incorrect:

This is correct:
This is correct:

Note: To interoperate with older browsers for a while, you should use both name and id, with identical attribute values, like this:
Note: For low-version browsers, you should use both the name and id attributes and make them have the same value, as shown in the following code:

IMPORTANT Compatibility Note:
Notes for compatibility:

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


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

The Lang Attribute
Lang attributes
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 element content.

If you use the lang attribute in an element, you must add the xml: lang attribute, like this:
If you apply the lang attribute to an element, you must add the xml: lang attribute, as shown in the following figure:

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

Mandatory XHTML Elements
Force XHTML Elements
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.
All XHTML documents must have a DOCTYPE. 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 very small XHTML document template.




Title goes here

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 shoshould not have a closing tag.
Note: The DOCTYPE declaration is not part of the XHTML document. It is neither an XHTML element nor a closed tag.

Note: The xmlns attribute insideTag is required in XHTML. however, the validator on w3.org does not complain when this attribute is missing in an XHTML document. this is because "xmlns = http://www.w3.org/1999/xhtml" is a fixed value and will be added toTag even if you do not include it.
Note: The XML document requires that the xmlns attribute appear in the html Tag. However, the w3.org validator does not report errors because this attribute does not appear in your XHTML document. This is because "xmlns = http://www.w3.org/1999/xhtml" is a fixed value that is automatically added even if it is not included in your document.

Heia Norge!

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.