HTML vs. XHTML – the difference

A graphical despiction of a very simple xhtml ...

Image via Wikipedia

If you’re new to web programming languages or you just have a strong interest in acronyms, you may have run across “HTML” and “XHTML” and wondered what the difference is.

 

Beyond having a fancy-pants “X” in front of the second one, for “extra-special,” no doubt.

 

Actually, “XHTML” (short for “eXtensible HyperText Markup Language”) is the newest version of HTML (drop the “eXtensible”) and it is dramatically different.

 

HTML is the programming language with which people put content on a web page and tell it how to display to your eager eyes. It’s composed of “tags,” such as < b > to put text in boldface and < / b > to turn off the boldface. Pretty basic stuff.

 

In the early days of the Internet, no one had a clear vision of what it would become or how pages should be written, so HTML is a very forgiving language. People could write really sloppy code, leaving tags open (lacking the closing bracket or even the entire cancel tag, such as < /b >) and cluttering up the page with redundancies. Usually the web browser could still make sense of it.

 

Now there are new devices, like smart-phones and the like, that can go on the web and are not so forgiving. They don’t know how to understand the sloppy pages with bad HTML.

 

XHTML was created in response to this new reality. It’s a much stricter language than HTML. It removes many of the old tags and standardizes or creates others.

 

Most importantly, there is no margin for error. The code must be perfect.

 

The concurrent development of CSS (Cascading Style Sheets), a separate language that controls how a web page is styled, means there’s less one has to put in HTML.

 

T0his, combined with XHTML’s greater rigor, results in much simpler code and cleaner pages, which is the goal.

Enhanced by Zemanta