Home > Article > Web Front-end > Day 6 of building a website using web standards: XHTML code specifications
Before starting formal content production, we must first understand the code specifications of web standards. Understanding these specifications can help you avoid detours and pass code verification as soon as possible.
1. All tags must have a corresponding closing tag
In the past, in HTML, you could open many tags, such as
and
2. The names of all tag elements and attributes must be in lowercase
Unlike HTML, XHTML is case-sensitive,
3. All xml tags must be nested reasonably
Also because XHTML requires a strict structure, all nesting must be in order. In the past, we wrote the code like this:
/b> That’s it That is, the nesting layer by layer must be strictly symmetrical.
4. All attributes must be enclosed in quotation marks ""
In HTML, you do not need to quote attribute values, but in XHTML, they must be quoted. For example:
Must be modified to:
Any less than sign (<), 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 ;
& a m p;
Note: There are no spaces between the above characters
6. Assign a value to all attributes
.XHTML stipulates that all attributes must have a value, and if there is no value, it will repeat itself. For example:
7. Do not use "--" in comment content
"--" can only occur at the beginning and end of XHTML comments, that is, they are no longer valid in the content. For example The following code is invalid:
Replace the interior with equal signs or spaces The dotted line.
The above is the content of Day 6 of building a website using Web standards: XHTML code specification. For more related content, please pay attention to PHP. Chinese website (www.php.cn)