Your Ad Here

HTML Document Structure


As you know, HTML (Hypertext Markup Language) is the basis for all things
web. And you also probably know that HTML has different version numbers,
and that there is a character on the block known as XHTML. Without going
into lengthy detail about the version histories and differences, I’ll cut to
the chase: HTML 4.01 is the latest version of HTML. The W3C (World Wide
Web Consortium) is working on a draft of HTML 5.0, which is slated to be
released “soon.” XHTML was created to be an “extensible” version of HTML,
which means that it conforms to the XML syntax and can be made modular
(divided into usable components).
To learn more about HTML, see http://www.w3.org/ TR/html4/.
The main difference between the two forms of markup is that XHTML by
definition needs to be well formed; therefore, all elements need to be in
lowercase, all elements need to be closed, and attributes are case-sensitive.
By contrast, HTML, technically, does not need to be all in lowercase, empty
elements do not have to be closed, nor are the attributes case-sensitive.
However, just because the specification says you can be loosey-goosey about
those items doesn’t mean you should be. To conform to best practices and
industry standards, you should create consistent, well-formed, semantically
correct documents.
Here are the underpinnings of a “well-formed” HTML document in a nutshell:


1. All elements are closed.
2. All tags are in lowercase.
3. All attributes values are enclosed by quotes.
4. All elements are properly nested.
A basic HTML 4.01 document using the strict doctype definition looks like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
. "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>HTML 4.01 Strict Document</title>
</head>
<body>
</body>
</html>


A basic XHTML 1.0 document using the transitional doctype defi nition looks
like this:
<!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> XHTML 1.0 Transitional Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
</body>
</html>


0 comments:

Post a Comment

Popular Posts

Recent posts