My HP

14th November, 2012 | Articles |

XHTML the basic guide

Need Hosting? Try ours, it's fast, reliable and feature loaded with support you can depend on. From £1.60 / month.

View Plans

Many people have heard of HTML, or HyperText Markup Language, as it is used in many locations across the internet. However, there aren't nearly as many people who could explain what XHTML is; after all, this acronym isn't as commonly seen around the web.

XHTML is closely related to regular HTML. The acronym stands for Extensible HyperText Markup Language. It has the same depth as HTML, but it isn't quite as flexible. This is because XHTML is also closely related to XML, which is rather restrictive. In several aspects, XHTML can really be thought of as a merger between XML and HTML.

The Difficulty of XHTML

Because XHTML involves aspects of both HTML and XML, it can seem confusing to many. Additionally, documents must be well-formed (this aspect of XML is the same in XHTML). So, XHTML isn't quite as forgiving of errors as HTML, and errors are common when people are first learning. Here are some of the most common errors:

People forget to close empty elements. In HTML4, some elements didn't have closing tags; however, with XHTML, these elements must be closed. For instance,
didn't have a closing tag in HTML4. For XHTML, though, the correct tag should be
. Likewise, writers forget to close non-empty elements, such as for 'paragraph.' For XHTML, there should be a beginning tag of

and an ending tag of

.

Nesting elements incorrectly continues to be an issue. This has been an issue in HTML, and it is an issue with XHTML. The first tag listed should be the last to be closed. For example, this would not be correct: I like XHTML.

Instead, it should be:

I like XHTML.

XHTML Differences

When XHTML first came along, it really wasn't all that different from HTML. In fact, the few changes made to HTML to turn it to XHTML were to make the documents well-formed like XML and to attain conformance with XML. Also, in XML, the names of the elements and attributes were all case-sensitive; therefore, for XHTML all tag names were done in lowercase.

More differences between XHTML and HTML began to come up when HTML 2.0 came out. This is because HTML 2.0 used uppercase tags. However, as time went on and HTML 4.0 was released, XHTML and HTML were once again quite similar. At this point, many websites and content management systems began to use XHTML rather than HTML.

Not all web browsers support XHTML, though-and this is why there are still some who are leery of switching. In fact, Internet Explorer by Microsoft does not support it. According to a Microsoft developer, this is because their priorities are elsewhere; nonetheless, the fact that the largest internet browser doesn't support this language is a large blow. Additionally, because of this lack of support, many people are questioning whether or not XHTML is really here to stay and if it is worth learning and using.

XHTML, like any internet language, will take time and effort to learn-but, if you are a website developer, it may be a good idea to try it out.

Need Hosting? Try ours, it's fast, reliable and feature loaded with support you can depend on. From £1.60 / month.

View Plans