Finally, let’s look at how a strict XHTML 1.0 document is laid out:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Our title</title>
</head>
<body>
<p>Our content</p>
</body>
</html>
Let’s now go through this markup one line at a time.
Doctype declaration
First we see a doctype declaration. A doctype declaration provides an indication as to
what Document Type Definition (DTD) you’re going to be writing your markup to. A
DTD is basically a page detailing the rules and grammar of the markup. It can look a little
daunting, but let’s break it down and examine each piece. The doctype starts off like this:
<!DOCTYPE
Nothing much more to say here; this is just how a doctype begins. The root element of the
document that will appear after the doctype declaration—the <html> element—needs to
be specified immediately after the opening of the declaration:
<!DOCTYPE html
Note that we can use html or HTML, depending on the version of (X)HTML we’re writing to
and how we’re writing it. For all XHTML doctypes, the root element should be in lowercase,
but for HTML doctypes the root element may be uppercase if the rest of your tags
are written so.
Following that, we have the word PUBLIC:
<!DOCTYPE html PUBLIC
This indicates that the DTD we’re about to reference is publicly available. If the DTD was
private, then we would use SYSTEM instead (as in “a system resource,” probably a locally
held resource somewhere on your network).
Next we have the Formal Public Identifier (FPI), which describes details about both the DTD
and the organization behind the DTD.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Our title</title>
</head>
<body>
<p>Our content</p>
</body>
</html>
Let’s now go through this markup one line at a time.
Doctype declaration
First we see a doctype declaration. A doctype declaration provides an indication as to
what Document Type Definition (DTD) you’re going to be writing your markup to. A
DTD is basically a page detailing the rules and grammar of the markup. It can look a little
daunting, but let’s break it down and examine each piece. The doctype starts off like this:
<!DOCTYPE
Nothing much more to say here; this is just how a doctype begins. The root element of the
document that will appear after the doctype declaration—the <html> element—needs to
be specified immediately after the opening of the declaration:
<!DOCTYPE html
Note that we can use html or HTML, depending on the version of (X)HTML we’re writing to
and how we’re writing it. For all XHTML doctypes, the root element should be in lowercase,
but for HTML doctypes the root element may be uppercase if the rest of your tags
are written so.
Following that, we have the word PUBLIC:
<!DOCTYPE html PUBLIC
This indicates that the DTD we’re about to reference is publicly available. If the DTD was
private, then we would use SYSTEM instead (as in “a system resource,” probably a locally
held resource somewhere on your network).
Next we have the Formal Public Identifier (FPI), which describes details about both the DTD
and the organization behind the DTD.