Previously in HTML, you could open many tags, such as <p> and <li> without necessarily writing the corresponding</p> and </li> to close them. But this is illegal in XHTML. XHTML requires a rigorous structure and all tags must be closed. If it is a single unpaired tag, add a "/" to the end of the tag to close it. For example:
<br /><img src="../images/logo_w3cn_200×80.gif" />
2. All the names of the elements and attributes of the tag must be lowercase.Unlike HTML, XHTML is case sensitive, and <title> and <TITLE> are different tags. XHTML requires that all tags and attribute names must be in lowercase. For example: <BODY> must be written as <body>. Case inclusions are not recognized. Usually, the attribute name "onMouseOver" automatically generated by dreamweaver must also be modified to "onmouseover".
3. All XHTML tags must be reasonably nestedAlso because XHTML requires a rigorous structure, all nesting must be in order. The code we wrote like this before:
<p><b></p>/b>must be modified to: <p><b></b>/p>
That is to say, the nesting layer by layer must be strictly symmetric.
4. All attributes must be enclosed in quotes ""In HTML, you can not have to quote attribute values, but in XHTML, they must be quoted. For example:
<height=80>must be modified to: <height="80">
In extraordinary situations, you need to use double quotes in the property value, you can use ", single quotes can be used', for example:
<alt="say'hello'">
5. All < and & extraordinary symbols are expressed in codeAny less than sign (<), which is not part of the tag, must be encoded as <
Any greater than the sign (>), which is not part of the tag, must be encoded as & gt;
Any & number (&), which is not part of an entity, must be encoded as &
Note: There are no spaces between the above characters.
6. Assign a value to all attributesXHTML stipulates that all attributes must have a value, and those without values will be repeated themselves. 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 use "" in the comment content"" can only happen 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:
<!Here is the comment - here is the comment>
Replace the dotted line inside with an equal sign or a space.
<!Here is comment=====================Here is comment>
Some of the above specifications seem rather amazing, but all of this is to make our code have a unified and unique standard for future data reuse.