What are the content of the xhtml specification in the Web standard?

Source: Internet
Author: User

What are the content of the xhtml specification in the Web standard?
1. All tags must have an ending mark.

PreviouslyHTMLYou can open many labels, such<p>And<li>Not necessarily write the corresponding</p>And</li>To close them. HoweverXHTMLIs invalid.XHTMLStrict structure is required, and all labels must be closed. If the tag is not paired, add"/"To close it.

2. The element and attribute names of all tags must be in lower case.

AndHTMLDifferent,XHTMLIt is case sensitive,<title>And<TITLE>Are different labels.XHTMLAll tags and attribute names must be in lower case. For example:<BODY>Must be written<body>. Case-insensitive, usuallydreamweaverAutomatically Generated attribute name"onMouseOver"Must also be modified"onmouseover".

3. All XML tags must be reasonably nested.

Similarly, because XHTML requires a rigorous structure, all nesting must be in order. The code we wrote earlier is as follows:

<p><b></p></b>

Must be modified:

<p><b></b></p>

That is to say, the nesting layer by layer must be strictly symmetric.

4. All attributes must be enclosed by quotation marks ("").

InHTMLYou do not need to quote the attribute value,XHTMLMust be enclosed in quotation marks. For example:
The following is a reference clip:

Must be modified:

In special cases, you need to use double quotation marks in the property values. You can use", Single quotes can be used&apos;For example:

<alt="say&apos;hello&apos;"> 
5. encode all <and & special characters

Any minor accounts(<), Not part of the tag, must be encoded&lt;
Any greater(>), Not part of the tag, must be encoded&gt;
Any and number(&), Not part of the object, must be encoded&amp;

6. assign a value to all attributes

XHTMLIt is required that all attributes must have a value. If there is no value, it should be repeated. For example:

<td nowrap> <input type="checkbox" name="shirt" value="medium" checked>

Must be modified:

<td nowrap="nowrap"> <input type="checkbox" name="shirt" value="medium" checked="checked"> 
7. Do not make "--" in the comment content

"--"Can only happen inXHTMLThe beginning and end of the comment, that is, they are no longer valid in the content. For example, the following code is invalid:

<! -- Here is the comment ----------- here is the comment -->

Replace the dotted line with equal signs or spaces.

<! -- Here is the comment ============= here is the comment -->
8. Minimize attributes

XMLAttribute minimization is not supported. attribute value pairs must be fully written. Imagecompact,checkedSuch an attribute name can appear in an element without specifying the attribute value.

Correct: Minimize attributes

<dl compact="compact">

Incorrect: the attribute is minimized.

<dl compact>

These specifications arexhtmlBut all this is to make our code have a unified and unique standard, so as to facilitate future data reuse.

Note: We will share some xhtml specifications.

 

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.