Xhtml
By starting to write strict HTML, you can prepare for XHTML.
How to prepare for XHTML
XHTML is not much different from the HTML 4.01 standard.
So it's a good start to upgrade your code to 4.01. The HTML 4.01 Reference manual will help you do this.
In addition, you should immediately write HTML code in lowercase letters, and never develop a bad habit of ignoring similar </p> tags.
Wish you can be happy to code!
The main differences are:
- XHTML elements must be nested correctly.
- XHTML elements must be closed.
- Label names must be in lowercase letters.
- XHTML documents must have root elements.
Elements must be nested correctly
In HTML, some elements can be nested incorrectly like this:
<b><i>this text is bold and italic </b>
</i>
In XHTML, all elements must be nested correctly like this:
<b><i>this text is bold and italic</i></b>
Tip: An easy mistake in a nested list is to forget that the internal list must reside in the LI element, as follows:
This is wrong:
<ul> <li>Coffee</li> <li>Tea
<ul> <li>black tea</li> < Li>green tea</li> </ul> <li>Milk</li></ul>
That's right:
<ul> <li>Coffee</li> tea <li>
<ul> <li>black tea</li> <li>green tea</li> </ul> </li>
<li>Milk</li></ul>
Note: In the case of the correct code, we insert a </li> tag after </ul>.
XHTML elements must be closed
A non-empty label must use an end tag.
This is wrong:
<p>
This is a paragraph the this is <p>
another paragraph
That's right:
<p>
This is a paragraph the this is </p>
<p>
another paragraph</p>
Empty labels must also be closed
An empty label must also use an end tag, or its start tag must use the />
end.
This is wrong:
A break: <br>a Horizontal rule:
That's right:
/>
/>
/>
XHTML elements must be lowercase
XHTML specification Definition: Tag names and attributes are case-sensitive.
This is wrong:
<BODY>
<P>
This is a paragraph</P>
</BODY>
That's right:
<body>
<p>
This is a paragraph</p>
</body>
XHTML documents must have a root element
All XHTML elements must be nested within the