Screen Printing

TUTORIALS » HTML / JavaScript » HTML essentials (guided tutorials)

XHTML vs HTML

Page 2 of 6


The <!DOCTYPE> declaration

<!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>Title of the document</title>
</head>

<body>
   Contents of the document
</body>

</html>
The Document Type Definition—also known as the DTD or the
<!DOCTYPE>
tag—is the section that tells your browser what type and version of HTML you are coding. In our case it is Transitional XHTML v1.0.

It's very important to start your document with the DTD declaration (at the very first line) or else the browser won't know which rules to use in order to process your HTML code.

From now on we will be using Transitional XHTML v1.0 in all of our exercises. There are two other DTD's allowed for XHTML—Strict and Frameset—but we won't be using them yet (actually, I barely ever use them).

To make it simple, just copy and paste
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-ransitional.dtd">
at the beginning of each XHTML document you create and you will be fine.

More pages of this tutorial → XHTML vs HTML  <123456>

Comments & Questions