Unstoppable Domains

From HTML to XHTML

Spaceship Spaceship
Watch

shahid_146

Established Member
Impact
2
HTML has been the most successful publishing language for web pages since the beginning of the World Wide Web (WWW). HTML 4.01 is the last W3C recommended version after 2.0 and 3.2. It supports the tags in the earlier versions and has got additional support for more multimedia, scripting languages, style sheets, better printing facilities and accessibility. Apart from all the goods with HTML, it has been treated as a 'let go' language by both developers and browsers. The 'loose' nature of HTML markup has resulted in ill-formed documents, still displayed properly in some browsers.

A need for a well-formed, flexible and more suitable language for large-scale electronic publishing gave birth to XML (Extendible Markup Language). XML is a simpler but much more flexible markup language, which provides you with the ability to exchange data in a variety of formats on the web.

With the development of better browsers and introduction of mobile phones and hand-held devices who do not have the resources or power to display a 'badly written markup' properly, a need arose for a language which combines the strengths of both HTML and XML.

XHTML was introduced as a result. XHTML is a stricter and cleaner version of HTML. XHTML is supposed to gradually replace HTML according to W3C. XHTML consists of all the elements used in HTML 4.01 combined with the syntax of XML.

To stay up to date with the latest web standards, enjoy the luxury of having your documents equally well-interpreted by electronic devices and produce nicely formed markup, it is time to upgrade your code to XHTML, the markup language of today and the future.

Migrating from HTML to XHTML is much easier than one might think. Because of the fact that it is actually based on HTML 4.01, XHTML is almost similar to HTML with a few enhancements.

The purpose of this article is to highlight the changes that you need to make to your markup while migrating from HTML to XHTML. Below is the list of changes that need to be made to an existing HTML document in order to make it XHTML compliant:

All tags must be written in lower case. (XML and so XHTML is case sensitive). For example <P> is wrong and it should be written as <p>.
All attribute names must also be in lower case. For example <img SRC=”name.jpg”> is wrongs and the attribute SRC should be written in lower case.
All Attribute values must be quoted. As a result <table width=100%> is wrong and it should be written as <table width=”100%”>
No more attribute minimization. For example in HTML you could write <option value=”1” selected> which is wrong in XHTML now and the right syntax is <option value=”1” selected=”selected”>. The same rule applies to:
<input checked="checked" />
<input readonly="readonly" />
<input disabled="disabled" />
<option selected="selected" />
<frame noresize="noresize" />
All XHTML elements must be closed. Elements must either have an end tag or otherwise their start tag should end with />. For example every <p> must be ended with a </p> and every <li> with an </li>, while empty tags (tags with no ending tag) should be ended with />, e.g. <br />, <input type=”submit” />, <img src=”name.jpg” /> and <hr /> **put a space before / to make your code compatible with the new browsers.
All tags must be properly nested. Tags starting first should end last and vice versa. So <b><i>some text for demonstration</b></i> would be WRONG. List inside a list should be enclosed in between one of the <li> …</li> of the parent <ul> or <ol>
The id attribute replaces the name attribute. For example <form name=”search”> is replaced by <form id=”search”>
All XHTML documents must have a DOCTYPE declaration. The html, head and body elements must be present, and the title must be present inside the head element.
A typical xhtml document should look like this:

<!DOCTYPE Doctype goes here>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title goes here</title>
</head>
<body>
Body text goes here
</body>
</html>


Article originally posted at binarytrends
 
1
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Nice post, I'm just in the process of having 60+ pages hand coded to W3C
standards. It will be very interesting to see exactly how the search engines
spider and eventually rank my new site Vs the old one, especially in MSN.
 
0
•••
That's a great post that sums up all of the main points from HTML to XHTML. I wish I had read this post sooner... would have saved me some trouble ;)

Rep added.
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back