Difference between HTML and XHTML

xhtml11.png
Difference between HTML and XHTML
Few years back only there was a fire blazing to use HTML code for designing websites. Its presentation was later on succeeded by CSS. CSS used style sheets for the purposes. These definitely improved the materialization and appearance of all the websites. Today, HTML has been further improvised to XHTML.

XHTML is a more stable, sharpened and sophisticated version. This further introduced the concept of tagging into the websites. While going through modern version, most Word Press themes have been designed on XHTML rather then HTML. With the use of XHTML done in bulk across the web, it is imperative for users, who are designing, changing or preparing their themes, to know the difference between XHTML & HTML. These differences might even help in knowing the different validation errors, which usually arise from improper XHTML usage.

What is HTML & XHTML?
Hyper Text Markup Language or HTML is the means for describing the structure of text information in all web documents. It also helps in supplementing texts with embedded images, interactive forms and numerous objects. Extensible Hyper Text Markup Language or XHTML is similar in most features to HTML. It has been designed for being a HTML successor. Most experts say that the best way of referring XHTML is to call it a better HTML.

The Differences
With a basic knowledge about HTML, you are going to feel glad in knowing that major part of the HTML scripts is still applicable in XHTML. XHTML is nothing but a completion HTML codes.

All the tags should be closed
Tag closing is a compulsion in XHTML. In HTML,

tag can be used for opening it and not for closing. In HTML, there is a liberty to ignore validation of the code. However in XHTML, such concept is incorrect and the code would never validate.

XHTML closes the tags that were previously left open by HTML and hence completes it. These closing tags were always necessary. By using XHTML, you are just enforcing it.

Self-closing tags
XHTML now puts more emphasis on closing ALL the tags and it is not limited only to an open tag. Items including images or line breaks that are without HTML closing tags should have XHTML self-closing.

Alternative Text Images
All the XHTML image tags should be provided with alt attributes. None of the attributes are the region for editorial commentaries about any picture. Alt tags should always contain the image description. This allows them to meet requirements for accessibility along with different web standards.

Tagging in nested form
In XHTML, closing of the nested tags should be done in the same form in which opening was performed. Although nesting is also followed in HTML, yet it is not as strict as in XHTML.

Use of lowercase tags
In case of HTML, you can get away even if you are using tags in uppercase similar to
. However with XHTML, all the tags should be in lowercase similar to
.

It can be said that both these themes are almost similar. The only thing that differentiates both of them is that XHTML is stricter in rules than HTML.

  1. One Response to “Difference between HTML and XHTML”

  2. I use phpBay Pro and now the script won't run using your XHTML templates. Any advice?

    By Lee on Apr 21, 2008