XHTML vs. HTML

XHTML vs. HTMLI know that many people still use HTML 4.01, but with the introduction of XHTML and unending browser updates, it is becoming less popular in favour of this new web standard. This tutorial is just an introduction to XHTML.

Firstly though, what is XHTML?

XHTML is pretty much the same as HTML with several small differences. It stands for Extensible HyperText Markup Language. It is a combination of HTML and XML. As it is a web standard, all new browsers support it and eventually, it will replace HTML.

So why use XHTML?

Well, there is an ever-growing number of badly formed documents and many browsers on things such as PDAs and phones cannot interpret these. XHTML requires well-formed documents because XML is a markup language which needs to have everything marked up properly. Therefore, XHTML documents can be used on all browsers with XML support.

What are the some of the most important differences between XHTML and HTML?

Tag names and attributes must be in lowercase. For example,

<BODY>

would be incorrect as XML is case sensitive. Therefore, it treats

<BODY>

and

<body>

as seperate tags.

Also, all elements must be closed. For example,

<li>...</li>

Tags which don't have a closing tag such as

<img>

and

<input>

must also be closed. This is done by adding " /" to the end of it, for example,

<img src="image.jpg" alt="This is an image" />

Line breaks and horizontal rules must also be closed, so correct examples of these would be:

and

<hr />

All elements must also be properly nested. Some elements can be nested incorrectly in HTML, for example,

<b><u>...</b></u>

However, this is not the case in XHTML. The correct version is:

<b><u>...</u></b>

The values of attributes must be quoted. For example,

<img src=image.gif height=100 alt=Image />

is incorrect. In XHTML, it must be:

<img src="image.gif" height="100" alt="Image" />

The name attribute is now replaced by id. However, the name and id tags should be used together in order to operate on older browsers, e.g.

<img src="image.png" id="logo" name="logo" />

This was just a very basic introduction to XHTML. For more information, visit the w3schools site. (www.w3schools.com)


Related Articles

  • XHTML vs. HTML
    A quick introduction to XHTML
  • Why You Shouldn't Be Using XHTML
    A lot of people these days are using XHTML. Why? Do they actually need it or are they just following a trend?
  • What is XHTML?
    We have all heard of HTML. HTML stands for Hypertext Markup Language. What is a hypertext markup language, you ask? It is a language for specifying how certain text should appear. When you design a web page, you want certain content or text to be displayed in a specific way.
  • Comprehensive Guide to Xhtml
    Since some time, the internet has been relying on HTML... or Hyper Text Markup Language... Since its been invented, many tries to replace it have been thought up, but none as successfull as XHTML (eXtensive Hyper Text Markup Language)... lets say that its HTML cleaned up...
  • XHTML bridges the gulf between HTML and XML
    Bringing XML to todays HTML-based Web, XHTML justifies the breakthrough label. It will rise slowly but surely. If you take any interest in Web technology, youll have come across references to...
  • Code Validation & Compliancy - The New Beginning XHTML
    Code validation is still widely debated as to whether it is required for performance within the search engines. It is only a guess that the search engines dont utilise it within their algorithm, but nobody is actually 100% sure on that fact...
  • XHTML and Stylesheets
    Want to build website content that can be processed by XML-compliant tools? If you answered yes, then its time to learn the rules governing XHTML.
  • Why is Validation Important?
    Validation in your webpages is very important as proven in this tutorial. In this tutorial youll learn about Validation and how you should be making the effort to get validated!
  • highlight_string(); With Valid XHTML 1.0 Strict Output
    This small guide aims to take the standard output from the PHP function highlight_string() and make it completely valid XHTML 1.0 Strict.
  • Server Side Includes
    This very helpful tutorial makes it much easier to make changes throughout your entire website. It is easy to follow and has plenty of code.

Contact Web Design Outsource and get started today

Need Website Designing, Development, Redesigning, Maintenance and SEO services or help growing your company's web presence? Request a free Quote Now.