The first line of the code above:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www. w3.org/TR/html4/loose.dtd">
is called a “doctype,” and it simply identifies what flavor of HTML you used to write the page. Developers have used two doctypes for years—HTML 4.01 and XHTML 1.0—and each has two styles: strict and transitional. Dreamweaver can create any of these types of HTML documents—you simply tell it which one you want when you create a new web page (see Creating a Web Page) and Dreamweaver handles the rest.
Dreamweaver even lets you use the latest, greatest, and simplest doctype, HTML5. It replaces the extraneous code of earlier doctypes with much simpler and straightforward code:
<!DOCTYPE HTML>
Yep, that’s it. HTML5 is intended to be much easier to use in many ways, and Dreamweaver CS6 provides limited support for this new version of HTML. This book uses the HTML5 doctype—it’s short, simple, and supported by every major browser (even back to Internet Explorer 6). And because HTML5 is the future of the Web, there’s no reason to use older doctypes any longer.
But no matter which doctype you’re interested in, it’s important that you always use one, because without it, different browsers display CSS differently, and your pages will look different depending on your visitor’s browser.
Different doctypes do require that you write your HTML in a particular way. For example, the line break tag looks like this in HTML 4.01:
<br>
But in XHTML, it’s written this way:
<br />
HTML5 lets you write it either way. Fortunately, you won’t have to worry about these subtle differences when you use Dreamweaver to insert your HTML—it automatically adjusts to the doctype and inserts the appropriate HTML.
Get Dreamweaver CS6: The Missing Manual now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.