What are the content of the xhtml specification in the Web standard?
1. All tags must have an ending mark.
PreviouslyHTML
You can open many labels, such<p>
And<li>
Not necessarily write the corresponding</p>
And</li>
To close them. HoweverXHTML
Is invalid.XHTML
Strict 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.
AndHTML
Different,XHTML
It is case sensitive,<title>
And<TITLE>
Are different labels.XHTML
All tags and attribute names must be in lower case. For example:<BODY>
Must be written<body>
. Case-insensitive, usuallydreamweaver
Automatically 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 ("").
InHTML
You do not need to quote the attribute value,XHTML
Must 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'
For example:
<alt="say'hello'">
5. encode all <and & special characters
Any minor accounts(<)
, Not part of the tag, must be encoded<
Any greater(>)
, Not part of the tag, must be encoded>
Any and number(&)
, Not part of the object, must be encoded&
6. assign a value to all attributes
XHTML
It 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 inXHTML
The 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
XML
Attribute minimization is not supported. attribute value pairs must be fully written. Imagecompact
,checked
Such 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 arexhtml
But 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.