Well, it is not that different really. The biggest difference between HTML and
XHTML is that XHTML rules are more rigid. Most of the tags and attributes are the
same but the syntax is much stricter.
Here's a list of some of the major differences between HTML and XHTML.
-
Tags must are case sensitive. So
the tags <p> and <P>
are different tags in XHTML. This is not true in HTML where <P>
is the same as <p>
-
All tags must be properly nested. You can't
have the closing tags the opposite way round from the opening tags. For example,
you can have <b><i>bold
and italic</i></b>
but not <b><i>bold
and italic</b></i>.
-
All tags must have a closing tag.
This was largely true in HTML but browsers would cope if you missed out, for
example, a closing </p>
or </li> tag. This
is not the case in XHTML. Similarly in HTML there are a few tags known as empty
tags that don’t have a closing tag. An example is <br>
or <hr>.
This also no longer applies. Empty tags must have a closing tag
-
All attributes must now be inside double
quotes. For example, you must now use <table
width="600"> and not <table
width=600>. The quote marks weren't compulsory in HTML
-
All attributes must have a value.
Yes, that does mean every attribute.Even if it didn't need one before
-
The id attribute replaces
the name attribute
-
Scripts and styles must have
a type definition
-
Some tags are mandatory
|
|
More information
XHTML
How is XHTML different to HTML?
Tags are case sensitive
Tags cannot overlap
All tags need a closing tag
All attributes need double quotes
All attributes need values
The id attribute replaces the name
Scripts and styles need cdata
Some tags are mandatory |