XHTML We first take a look at the code specifications for Web standards. Understanding these specifications can help you take fewer detours and pass code verification as soon as possible.
1. All tags must have a corresponding end tag
Previously in HTML, you could open a number of tags, such as <p> and <li> without necessarily writing the corresponding </p> and </li> to close them. But this is not legal in XHTML. XHTML requires a rigorous structure, and all tags must be closed. If it is a single, unpaired label, add a "/" at the end of the label to close it. For example:
<BR/>
2. All label elements and attributes must be named with lowercase
Unlike HTML, XHTML is sensitive to case,<title> and <TITLE> is a different label. XHTML requires that all labels and attribute names must be in lowercase. For example,:<body> must be written in <body>. Case-by-case inclusions are also not recognized, usually Dreamweaver automatically generated property names "OnMouseOver" must also be modified to "onMouseOver."
3. All XML tags must be nested properly
Also because XHTML requires a rigorous structure, all nesting must be in order, as previously written code:
<p><b></p>/b>
Must be modified to:
<p><b></b>/p>
That is, a layer of nesting must be strictly symmetric.
4. All attributes must be enclosed in quotation marks ""
In HTML, you may not need to enclose attribute values in quotes, but in XHTML they must be quoted. For example:
Must be modified to:
In special cases, you need to use double quotes in the attribute value, which you can use ", single quotes", for example:
<alt= "Say ' Hello '" >
5. Encode all < and & special symbols
Any less than (<), which is not part of the label, must be encoded as & L T;
Any greater-than sign (>), which is not part of the label, must be encoded as & G T;
Any number (&), which is not part of the entity, must be encoded as & a M p;
Note: There are no spaces between the above characters.
6. Assign a value to all properties
XHTML stipulates that all attributes must have a value, and that no value repeats itself. For example:
<TD nowrap> <input type= "checkbox" name= "Shirt" value= "Medium" checked>
Must be modified to:
<TD nowrap= "nowrap" > <input type= "checkbox" name= "Shirt" value= "Medium" checked= "checked" >
7. Do not in the annotation content to make "--"
"--" can only occur at the beginning and end of XHTML annotations, that is, they are no longer valid in the content. For example, the following code is not valid:
<!--here is the annotation-----------here is the annotation-->
Replaces the internal dashed line with an equal sign or a space.
<!--here is the annotation ============ here is the annotation-->
Some of these specifications look strange, but all of this is to make our code have a unified, unique standard for future data reuse.