Differences Between XHTML And HTML
Get Ready For XHTML
XHTML is not very different from the HTML 4.01 standard.
So, bringing your code up to the 4.01 standard is a good start.
Our complete HTML 4.01 reference can help you with that.
In addition, you should start NOW to write your HTML code in lowercase letters, and NEVER skip
closing tags (like </p>).
The Most Important Differences:
- XHTML elements must be properly nested
- XHTML elements must always be closed
- XHTML elements must be in lowercase
- XHTML documents must have one root element
XHTML Elements Must Be Properly Nested
In HTML, some elements can be improperly nested within 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:
| <b><i>This text is bold and italic</i></b> |
Note: A common mistake with nested lists, is to forget that the inside list must be within <li> and </li> tags.
This is wrong:
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
<li>Milk</li>
</ul> |
This is correct:
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul> |
Notice that we have inserted a </li> tag after the </ul> tag
in the "correct" code example.
XHTML Elements Must Always Be Closed
Non-empty elements must have a closing tag.
This is wrong:
<p>This is a paragraph
<p>This is another paragraph |
This is correct:
<p>This is a paragraph</p>
<p>This is another paragraph</p> |
Empty Elements Must Also Be Closed
Empty elements must also be closed.
This is wrong:
A break: <br>
A horizontal rule: <hr>
An image: <img src="happy.gif" alt="Happy face"> |
This is correct:
A break: <br />
A horizontal rule: <hr />
An image: <img src="happy.gif" alt="Happy face" /> |
XHTML Elements Must Be In Lower Case
Tag names and attributes must be in lower case.
This is wrong:
<BODY>
<P>This is a paragraph</P>
</BODY> |
This is correct:
<body>
<p>This is a paragraph</p>
</body> |
XHTML Documents Must Have One Root Element
All XHTML elements must be nested within the <html> root element. Child
elements must be in pairs
and correctly nested within their parent element.
The basic document structure
is:
<html>
<head> ... </head>
<body> ... </body>
</html> |
Make your web applications look like a million bucks
|
|
Most web applications today use boring methods to present data to their viewers using grids or simple HTML tables. FusionCharts induces "life" into the web applications by converting monotonous data into lively charts, gauges & maps.
FusionCharts works with all technologies like ASP, ASP.NET, PHP, ColdFusion, Ruby on Rails, JSP, HTML pages etc.
and connects to any database to render animated & interactive charts. It takes less than 15 minutes and no expertise
whatsoever to build your first chart and just a glance of it to captivate your audience. This fact is endorsed by our
12,000 customers and 150,000 users which include a majority of the Fortune 500 companies.
And yeah, your applications could look like a million bucks by spending just $69.
So go ahead, download your
copy of FusionCharts and start "wow-ing" your customers now!
|
 |
W3Schools' Online Certification Program
The perfect solution for professionals who need to balance work, family, and career building.
More than 4000 certificates already issued!
|
The HTML Certificate documents your knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
|