HTML and XHTML: What's the difference?
HTML and XHTML are essentially the same language. However, there is a difference between them. One belongs to the future and the other might soon become extinct. You better pick the right one for your use.
The Internet, The World Wide Web and HTML
The Internet is a myriad of computers connected to one another. The World Wide Web is a volatile collection of billions of documents that reside on these computers and are written in a form of HTML. Finally, HTML, or HyperText Markup Language, is the basic language of the Internet with two important features:
- you can create links in HTML thus accessing other parts of the Internet,
- any computer can read HTML, because it's stored in text-only files.
Although, any computer can read an HTML page, it doesn't mean everybody will experience the same phenomenon while viewing a page. Your experience will depend on the type of computer, the monitor, the speed of the Internet connection, and lastly, the software used to view the page: the browser.
It's sort of like the French Riviera. It's essentially the same thing, however a person living in a luxury apartment in a five star hotel on the beach will see it differently from a person who sleeps on a bench.
Browsers and Browser Wars.
When you design a web page, don't worry too much, as your control is limited at best. People viewing your page won't get the experience you intend to give them. Browsers, like Opera, IE, Safari or Firefox, all display the same web page slightly differently.
Companies in the '90s, guided by their greed for money and a bigger chunk of the Internet, wanted to ruin our experience of the French Riviera. They were like five-star hotels sectioning of their own parcels of the beach raising big fences so that we, the tourist, could not walk freely, but instead were limited to the small areas owned by the hotel we stayed in.
How did this come about?
In 1994, Netscape Communications Company created a set of extensions to HTML that only their browsers could view. They deprived HTML of its second important feature of being text-based. They sectioned off a part of the beach where no one but their guests could enter. Surfers using Netscape could view pages with colored text, photographs, and other improvements, while those using other browsers could not. And since everyone liked Netscape's parcel of the beach they flocked to the company and its browser.
Microsoft didn't take long to follow suit. And then other companies followed. Web developers had a hard time designing websites that could be viewed in most browsers without the loss of much of their appeal.
W3C - the Web Police
The aim and purpose of the World Wide Web Consortium is to convince the Web community of the importance of universality while attempting to satisfy its thirst for beautiful looking pages. At the peak of the browser wars this universality was almost completely ruined. The W3C had to break down the fences and push for standardization.
The W3C consists of all the companies that own the web. Their membership list is found here:
http://www.w3.org/Consortium/Member/List
Their aim is to come together, agree on the standards and try to differentiate their products with speed, ease of use, price, and other features that don't turn the Web into the tower of Babel.
Standardization of HTML
Goals:
- standardizing the proprietary extensions:
- including some in the official specifications
- removing others altogether, - encouraging browser manufacturers to closely support the official HTML specifications,
- breaking with the tradition of joining content, structure, and formatting in a single document,
- formatting instructions saved separately from the content and structure allowing their application to not just to single paragraphs or pages but to the entire site.
CSS and XML
These goals resulted in the creation of Cascading Style Sheets (CSS) and the deprecation of formatting elements from HTML.
A new language was created in place of HTML to give web pages the desired structure that would make sloppy code go away and replace it with a system to which new features could be added. This language was XML or Extensible Markup Language.
XML was very similar to HTML, but it was not intended to create web pages. It was a language for creating other languages. These created custom languages would then in turn be used to create the formatting of web pages.
The price was high. XML was a much stricter language than HTML. It demanded careful attention to upper- and lowercase letters, quotation marks, closing tags, and other minutiae. The question remained, what would happen to the millions of web pages already written in HTML.
The Annihilation of the Wicked and XHTML
Since XML was a language to design other languages, the W3C could rewrite HTML in XML so that the new language had all the features of HTML, making it possible to be read by all browsers, while it also gained the power of the firm structure of XML, making it suitable to be used with CSS. This new language became known as XHTML.
HTML and XHTML are essentially the same language, but XHTML has a much stricter syntax. Browsers can understand both languages. However, as the standardization of the web is moving forward the deprecated tags are expected to slowly disappear and fade out of use. This means that future browsers may not be able to recognize them any more. To be on the safe side, web designers are advised to use XHTML syntax and forget these ancient tags. Web pages are expected to derive their formatting information from attached CSS rather than deprecated formatting tags.