Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

Working with HTML DOCTYPE Declarations in FrontPage

Office 2003

Lisa Wollin
Microsoft Corporation

May 2004

Applies to:
Microsoft® Office FrontPage® 2003
Microsoft FrontPage 2002
Microsoft FrontPage 2000

Summary: Learn what HTML DOCTYPE declarations are and how to determine whether to use them. (7 printed pages)

Contents

Introduction
Determining Which DOCTYPE to Use
List of HTML DOCTYPE Declarations
Changes in HTML Recommendations
Using DOCTYPE Declarations in FrontPage
Resources
Conclusion

Introduction

DOCTYPE is short for Document Type. When you declare the HTML DOCTYPE, you tell the browser which version of HTML that a Web page uses. This is called a DOCTYPE declaration. Because there are multiple versions of HTML, browsers use the DOCTYPE declaration to determine how to render the page.

DOCTYPE declarations are technically optional, and not using one does not cause an error; for example, you can create a Web page without a DOCTYPE declaration, and Microsoft® Internet Explorer, Netscape Navigator, Mozilla, and Opera may all render the page as you intended. However, as your Web pages become more complex, lack of a DOCTYPE declaration can cause pages to render differently than expected or desired. (This is sometimes referred to as "quirks mode.")

In addition, if you design a Web page using one DOCTYPE definition, changing to another DOCTYPE definition might cause the page to display differently. Therefore, determining whether to use a DOCTYPE declaration and which DOCTYPE declaration to use is important if you want all browsers to accurately render your pages.

A DOCTYPE declaration is also necessary if you want to use a validation tool to ensure that your HTML is valid. Web developers can use tools, such as the World Wide Web Consortium (W3C) Markup Validation Service, to validate the HTML in their pages. Valid HTML pages can ensure a minimum level of accessibility. Although a DOCTYPE declaration does not guarantee compliance with accessibility guidelines, validating your Web pages may help to find errors that may cause your Web pages to be inaccessible in various browsers.

A DOCTYPE declaration appears at the top of a Web page before all other elements. A valid DOCTYPE declaration consists of two parts: a definition of the HTML version that a page uses, and a path, also called a Uniform Resource Identifier (URI), to the document type definition (DTD) that defines the HTML version.

Note A DTD is a document that defines the structure of a markup language as well as elements and attributes. Because HTML is a markup language, the W3C provides DTDs for all HTML versions.

All HTML DOCTYPE declarations begin with the text <!DOCTYPE HTML, but the version and the location of the DTD change depending on the DOCTYPE version that you use.

The following example shows a valid DOCTYPE declaration for the HTML 4.01 Transitional specification, with the version appearing on the first line, and the DTD URI appearing on the second:

Copy
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

If a DOCTYPE declaration does not include a path to a DTD, the browser assumes the DTD, and display the pages based on that assumption. What this usually means is that the browser assumes that the page uses an outdated HTML specification and renders the page in backward-compatible mode.

Note Backward-compatible mode means that the browser may display your page using an earlier HTML specification than you intended, which may be fine but may also produce unexpected and undesirable results.

Determining Which DOCTYPE to Use

There are multiple versions of HTML, and each version of HTML may have multiple DTDs because each DTD has a different set of requirements. In fact, just adding any DOCTYPE declaration to your Web pages does not make them valid. If you add DOCTYPE declarations to your Web pages without designing them according to that standard, your Web pages may not validate and may render differently than expected or desired. Therefore, when you use a DOCTYPE declaration, you should ensure that you understand the specifications behind the HTML version and DTD.

For example, one DTD may require that all formatting is contained in cascading style sheets, while another DTD may allow formatting elements by setting attributes. To illustrate, the XHTML strict DTD does not permit setting the valign attribute but instead requires that you set a style sheet property to specify vertical alignment for an element. Conversely, the HTML 4.01 Transitional DTD allows using both the attribute and cascading style sheets to affect the appearance of an element.

However, you do not need to read every HTML specification and DTD to determine which DOCTYPE declaration to use. Instead, consider your audience. Who looks at your Web site, and which browsers do they use? If you know that visitors to your site all have the most recent browsers (for example, Internet Explorer 5.5 and later), you can use one of the HTML 4.01 or XHTML 1.0 DOCTYPE declarations and code your HTML pages to the corresponding DTD. If some of your users have earlier browsers, you may need to use an earlier HTML version, such as HTML 3.2.

Understanding your audience is a first step in determining which DOCTYPE declaration to use in your Web pages. After you determine which DOCTYPE declaration to use, you should consider using either the W3C Markup Validation Service or another HTML validator to ensure that your pages adhere to the DOCTYPE that you have declared in your pages. The validator marks anything that does not adhere to the specified DTD for the DOCTYPE, helping you learn which HTML elements and attributes are valid for the specified DOCTYPE and which are not.

List of HTML DOCTYPE Declarations

There are three major versions of HTML: HTML 4.01, HTML 3.2, and HTML 2.0. Each version has a subset of DTDs that apply to the version. The HTML versions are described in the following sections along with the valid DOCTYPE declarations for each version. For a complete list of W3C DTDs, see the List of valid DTDs you can use in your document on the W3C Web site.

Note The HTML specification and DOCTYPE declaration descriptions in the following sections are adapted from reference documents on the W3C Web site.

HTML 4.01

HTML 4.01 is a revision of HTML 4.0 and replaces the HTML 4.0 specification. The revision fixes minor errors that were found since the release of the HTML 4.0 specification. HTML 4.01 contains the elements and attributes from earlier HTML versions, and also supports multimedia, scripting, and cascading style sheets and improves accessibility for users with disabilities. For more information, see the HTML 4.01 specification.

HTML 4.01 DTD and DOCTYPE Declarations

The W3C provides the following DTDs for HTML 4.01:

HTML 3.2

HTML 3.2 is the first HTML specification that the W3C developed; it includes support for features such as tables, applets, text flow around images, superscripts, and subscripts, while providing backward compatibility with the existing HTML 2.0 standard. For more information, see the HTML 3.2 specification.

HTML 2.0

The HTML Working Group of the Internet Engineering Task Force (IETF) developed the HTML 2.0 specification. It provided the standard for core HTML features. The W3C marks the HTML 2.0 specification as obsolete and discourages its use.

Changes in HTML Recommendations

The Internet is changing constantly and with it the languages that browsers use to render Web pages. Extensible Markup Language (XML) is quickly becoming a standard for Web pages. In an effort to make XML more accessible from within Web pages, the W3C created the XHTML specification.

Note Similar to HTML, XML is a markup language designed for the Internet. However, unlike HTML, which was designed to define formatting of Web pages, XML was designed to describe data. Because XML is extensible, anyone can use XML to create custom elements and attributes.

XHTML 1.0

The current HTML recommendation is XHTML 1.0. XHTML 1.0 combines HTML and XML. According to the W3C, XHTML 1.0 "is a reformulation of HTML 4.01 in XML, and combines the strength of HTML 4 with the power of XML." Because XHTML 1.0 incorporates the elements and attributes HTML 4.01, browsers can render XHTML pages accurately. To transition your Web pages from earlier HTML versions, you should take a look at the HTML Compatibility Guidelines on the W3C Web site. For more information, see the XHTML 1.0 Specification.

When using XHTML 1.0, you are encouraged to preface the DOCTYPE declaration with an XML declaration. The XML declaration specifies the version of XML that the XHTML specification uses. Following is the current XML declaration for XML and XHTML documents:

Copy
<?xml version = "1.0"?>

XHTML 1.0 DTD and DOCTYPE Declarations

The W3C provides the following DTDs for XHTML 1.0:

XHTML 1.1

The XHTML 1.1 specification is a reformulation of XHTML 1.0 Strict that modularizes elements and attributes into convenient collections that you can use in documents that combine XHTML with content and services such as vector graphics, multimedia, math, electronic commerce, and more. It is the third recommendation for XHTML specifications. For more information, see XHTML 1.1 - Module-based XHTML and Modularization of XHTML.

Using DOCTYPE Declarations in FrontPage

As with most modern Web development tools, FrontPage may use design-time proprietary code and attributes for HTML tags that does not validate according to the standards of the W3C. If you use any design-time tools in FrontPage, your pages may not validate when submitted to a validator.

If you want to use DOCTYPE declarations in your FrontPage Web pages, you should either avoid using FrontPage design-time tools that insert custom markup or use the Optimize HTML feature (Tools menu) in FrontPage to remove most or all FrontPage design-time markup. This allows you to run the pages through a validator without receiving errors on FrontPage markup code.

For this reason, FrontPage does not include DOCTYPE declarations in new pages by default. You can add DOCTYPE declarations to your Web pages in three ways: You can paste the DOCTYPE declaration in Code view; you can insert a code snippet; or you can modify the default template that FrontPage uses to create new pages.

Entering DOCTYPE Declarations Using a Code Snippet

FrontPage includes code snippets for three DOCTYPE declarations: HTML 2.0, HTML 3.2, and HTML 4.01 Transitional. However, you should note that the code snippet for the HTML 4.01 Transitional DOCTYPE declaration does not include the URL to the DTD, which is important, as noted earlier, if you do not want the browser to render your Web page in a backward-compatible mode. Therefore, you need to modify the HTML 4.01 Transitional DOCTYPE code snippet to include a DTD reference for it to be valid. For information on working with code snippets in FrontPage, see the following FrontPage help resources on Office Online:

Modifying the FrontPage 2003 Default Template

FrontPage bases every new Web page that you create on a default template. This default template, called Normal.htm, is located at %ProgramFiles%\Microsoft Office\Templates\1033\Pages11\normal.tem\normal.htm. You can change the default HTML by opening this file in FrontPage and editing it as you would any other Web page.

To modify the Normal.htm template

  1. Open the Normal.htm file.
  2. Place the cursor before the HTML tag, and copy and paste the DOCTYPE that you want to use from the previous list.
  3. On the File menu, click Save.
Note In two situations, FrontPage 2003 does not create Web pages using the template. One, when you create a new Web site that contains a home page (either index.htm or default.htm), FrontPage does not use the Normal.htm template for that page. Two, when you use any of the FrontPage 2003 wizards that you can use to create a new Web site, the wizards do not use the Normal.htm template when creating pages for the Web site. However, when you add new pages to an existing Web site, FrontPage uses the default template to create these pages. For additional information, see How do I declare a default DOCTYPE in my new web pages?

Resources

For more information on why you may want to use a DOCTYPE, see the following resources:

In addition to these resources, you can find many more on the Internet. Just perform an Internet search on "DOCTYPE" and search through the returned results.

Conclusion

Although there may be many reasons why you may not want to use a DOCTYPE declaration, there are just as many reasons, and more, why you should use a DOCTYPE declaration. Understanding what a DOCTYPE is and the purposes for the various DOCTYPEs takes you one step closer to developing Web sites that display the same in all browsers.



Etc

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to to buy a cup of coffee for authors of this site

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: March, 12, 2019