Address: http://www.w3schools.com/xhtml/xhtml_html.asp
Translation: Fan weixiao
You can prepare yourself for XHTML by starting to write strict HTML.
You can write strict htmlCodeTo prepare for your xhml journey
How to get ready for XHTML
How to start XHTML?
XHTML is the next generation of HTML, but it will of course take some time before browsers and other software products are ready for it.
XHTML is the next generation language of HTML. Of course, it will be extended for a while before new browsers and other related software products emerge.
In the meantime there are some important things you can do to prepare yourself for it. as you will learn from this tutorial, XHTML is not very different from HTML 4.01, so bringing your code up to 4.01 standards is a very good start. our complete HTML 4.01 reference can help you with that.
In the meantime, there are some important things you can do to prepare for its learning. Just like what you can learn from this Guide, XHTML is not very different from html4.01, so it is a very good start to rewrite your code to the 4.01 standard, our complete html4.01 reference can help you solve this problem.
In addition, you shoshould start now to write your HTML code in lowercase letters, and never make the bad habit of skipping end tags like the </P>.
In addition, now you should start to write your HTML code with lower-case letters, and never skip the bad habit of ending tags like </P> as before.
Happy coding!
Indulge in coding!
The most important differences:
The main differences between the two are:
XHTML elements must be properly nested
XHTML documents must be well-formed
Tag names must be in lowercase
All XHTML elements must be closed
The XHTML element must be correctly nested.
XHTML documents must have a good format
The marked name must contain lowercase letters.
Both the left and right XHTML elements must have a close character.
Elements must be properly nested
Elements (TAGS) must be correctly nested
In HTML some elements can be improperly nested within each other like this:
In HTML, some tags can be incorrectly nested with each other, like this:
<B> <I> This text is bold and italic </B> </I>
In XHTML all elements must be properly nested within each other like this:
All the markup in XHTML must be correctly nested, like this:
<B> <I> This text is bold and italic </I> </B>
Note: a common mistake in nested lists, is to forget that the inside list must be within an Li element, like this:
Note: when the list is nested, you often make an error, that is, you forget that the inserted new list must be in a <li> tag, like this
<Ul>
<Li> coffee </LI>
<Li> tea
<Ul>
<Li> black tea </LI>
<Li> green tea </LI>
</Ul>
<Li> milk </LI>
</Ul>
This is correct:
Correct writing
Notice that we have inserted a </LI> tag after the </ul> tag in the "correct" code example.
In this correct code example, do you notice that a </LI> mark is added after </ul>?
Documents must be well-formed
The document must be in good format
All XHTML elements must be nested within the <HTML> root element. all other elements can have sub (children) elements. sub elements must be in pairs and correctly nested within their parent element. the basic document structure is:
All XHTML tags must be nested in the <HTML> root tag. All other tags can have their own child tags. Child tags located within the parent tag must also be paired and correctly nested. The basic structure of a webpage is as follows:
<HTML>
<Head>... <Body>... </body>
</Html>
Tag names must be in lower case
The marked name must contain lowercase letters.
This is because XHTML documents ENTs are XML applications. XML is case-sensitive. tags like <br> and <br> are interpreted as different tags.
This is because the XHTML document is an XML application.Program, XML is case-sensitive, such as <br> and <br> are considered as two non-co-occurrence tags.
This is wrong:
Incorrect:
<Body>
<P> This is a paragraph </P>
</Body>
This is correct:
Correct
<Body>
<P> This is a paragraph </P>
</Body>
All XHTML elements must be closed
All XHTML tags must have a close character.
Non-empty elements must have an end tag.
A non-empty mark must have a close character.
This is wrong:
This is incorrect:
<P> This is a paragraph
<P> This is another paragraph
This is correct:
This is correct.
<P> This is a paragraph </P>
<P> This is another paragraph </P>
Empty elements must also be closed
The empty tag must also have a close character.
Empty elements must either have an end tag or the start tag must end with/>.
The empty mark must end with a close character or start with A/>.
This is wrong:
Error Code
This is a break <br>
Here comes a horizontal rule: <HR>
Here's an image
This is correct:
Correct:
This is a break <br/>
Here comes a horizontal rule: <HR/>
Here's an image "/>
Important compatibility note:
Important Notes on compatibility:
To make your XHTML compatible with today's browsers, you should add an extra space before the "/" symbol like this: <br/>, and this: <HR/>.
To make your XHTML compatible with the current browser, you must add a special space before the/symbol, just like this: <br/> <HR/>
(For more information, see the source)