Before we begin our formal content production, we must first look at the specifications of the Web standards Code. Understanding these specifications can help you to take fewer detours and pass code validation as soon as possible.
1. All marks must have a corresponding closing tag
Previously in HTML, you could open many tags, such as
And
And not necessarily write the correspondingAnd
To close them. But it's not legal in XHTML. XHTML requires a rigorous structure, and all tags must be closed. If the label is not paired individually, close it by adding a "/" to the label at the end. For example:
2. The names of all the elements and attributes of the tag must be in lowercase
Unlike HTML, XHTML is case-sensitive,Andis a different label. XHTML requires that all labels and attribute names must be lowercase. For example:Must be written. Uppercase and lowercase inclusions are also not recognized, and typically Dreamweaver automatically generates attribute names "OnMouseOver" that must also be modified to "OnMouseOver".
3. All XML tags must be properly nested
Also because XHTML requires a rigorous structure, all of the nesting must be in order, as we have previously written code:
/b>
Must be modified to:
/p>
That is, a layer of nesting must be strictly symmetric.
4. All attributes must be enclosed in quotation marks ""
In HTML, you don't need to quote attribute values, 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 values, you can use ", single quotes can be used," for example:
5. To encode all the special symbols of the h3>
- any less than (<), not part of the label, must be encoded as & l t;
- any greater than sign (>), not part of the label, must be encoded as & g T;
- any number (&), 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 Specifies that all properties must have a value, and that no value repeats itself. Example:
must be modified to:
7. Do not make"--"
"--"in the comment content only at the beginning and end of the XHTML annotations, 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 inner dashed line with an equal sign or a space.
!--here is the comment ============ here is the comment-->
Above these specifications some look strange, but all of this is to make our code have a uniform, unique standard, convenient for the next few Use it again.