Home >
Main >
Extensible Hypertext Mark-up Language
Extensible Hypertext Mark-up Language
2008 October 01 | 10:27 pm
Introduction
XHTML is a fusion of HTML and XML, or Extensible Mark-up Language. XML documents must follow a strict guideline to be considered valid.
According to W3Schools, XML was designed to describe data and HTML was designed to display data. What this means is that HTML was originally designed to simply display a document in a remotely-accessible way. All of the attributes
that crept in as the web evolved are, quite frankly, kludge. XML is designed to give a rigid structure to our page's content, which can then be externally styled.
Advantage: XHTML
One of the best reasons to use XHTML over HTML is that it forces (or encourages, depending on the DTD being used) the designer to properly close every element tag, which ensures consistent page rendering across various web browsers.
Another equally important reason to use XHTML is that it allows us to separate our site's structure from it's style; XHTML does not support HTML inline styles, but rather specifies a style attribute. More on that later...
Disadvantages?
Um. Well. I honestly cannot think of any drawback to using XHTML over HTML. Sorry!
A Word from Our Sponsors...
If you really want to learn the ins-and-outs of web design, I strongly suggest you visit the awesome folks at W3Schools.com. That site has just about everything there is to know about proper web page development. I am merely going to paraphrase some of what I learned there and elsewhere.
Okay! Let's get this party started!
File Structure
XHTML looks a lot like HTML at the surface level, but there are some important differences. Gaze upon this most awesome of examples...
• samplepage.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Page Title Goes Here</title>
</head>
<body>
</body>
</html>
Break It Down!
So, did you notice the parts that are different? No? Well, then let's fix that!
The first difference you should notice is that XHTML adds another line of code to the top of the document. This extra line specifies the document type
, or DOCTYPE. The DOCTYPE is an externally referenced file used to define such things as what tags are and are not allowed, and how elements may be nested.
The next obvious difference: look at the <html> tag. See all that extra text? That defines which parser should be used to render the document. Since I previously chose a XHTML DTD, I need to also let the browser know that it needs to use a XHTML parser, too.
The rest of the page will look almost exactly like a HTML page. The main difference left between HTML and XHTML has to do with styling, which I will talk about more in my CSS page.
Do You Want to Know More...?
Check out the tag list if you want to see all of the available XHTML tags.
Definitions:
- DTD:
- DTD stands for Document Type Definition. A DTD states what tags and attributes are used to describe content in an SGML, XML or HTML document, where each tag is allowed, and which tags can appear within other tags. (Webopedia.com)
- DOCTYPE:
- The <!DOCTYPE$gt; declaration is the very first thing in your document, before the <html> tag. This tag tells the browser which HTML or XHTML specification the document uses. (W3Schools.com)
- Parser:
- In computer technology, a parser is a program, usually part of a compiler, that receives input in the form of sequential source program instructions, interactive online commands, markup tags, or some other defined interface and breaks them up into parts (for example, the nouns (objects), verbs (methods), and their attributes or options) that can then be managed by other programming (for example, other components in a compiler). A parser may also check to see that all input has been provided that is necessary. (whatis.com)
Updated:
2008 October 17 | 12:45 pm
Tags:
Web, XHTML, XML
Back to top •
Comments ( 0 ) •
Login to comment.
Home
About
Blog
Credits
RSS
Sorry. There are currently no comments for this article.