The Doctype declaration is so important to a Web page that it appears at the top on each HTML document. Doctype identifies a specific Document Type Definition (DTD). It contains information the Web browser uses to determine the markup language that will be used to load the Web page in the browser. Although there are several Doctypes, the two most used for XHTML are transitional and strict.
The Doctype is the first line that appears in the XHTML. It's a declaration, or an announcing, of the markup language to appear in document. In the Doctype syntax, the string, "<!DOCTYPE," appears first in uppercase letters, followed by "html" that informs the browser the element is HTML. This is used for both HTML and XHTML, since there are other kinds of markup languages. The word "PUBLIC" identifies the Doctype as being publicly available. The string to follow, which is "-//W3C//DTD XHTML 1.0 Transitional//EN," identifies the Doctype. In this example, it is XHTML 1.0 Transitional. The W3C stands for the World Wide Web Consortium. This is the organization that owns and maintains the Doctype, and establishes the rules for XHTML.
The following is the Doctype for transitional XHTML:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
This is the DOCTYPE for strict XHTML:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
Most Web developing software will insert the Doctype when you begin a new HTML document. However, you can still change the DTD version.
XHTML (eXtensible HyperText Markup Language) is created from HTML 4.01 and XML (Extensible Markup Language). Its introduction to the Web came as demand grew for cleaner and consistent markup for Web pages to appear as they were created -- no matter what browser the Web pages are viewed in. Although XHTML is similar to HTML 4.01, there are differences between the two. XHTML requires that elements be in lowercase, and all elements must be closed and nested correctly.
According to Sitepoint, the transitional DTD is most preferred because it incorporates both XHTML 1.0 and HTML 4.01, meaning current elements and attributes can be used to build a Web page -- and browsers will support the combination. Use of transitional DTD is also recommended to support older browsers because those browsers don't have built-in support for cascading style sheets.
Just as the transitional Doctype tells browsers to allow both HTML and XHTML, the strict Doctype informs browsers to follow the rules for XHTML only. This means no deprecated or obsolete elements and attributes will be allowed in the markup language. If any deprecated elements appear in the code, such as the "<underline>" tag, the Web page will not load properly. According to ScriptingMaster, use of the strict DTD allows the Web to validate XHTML documents quickly. This efficiency is possible because the presentation style of the pages has been separated from the content of the Web pages.
- Photo Credit Comstock/Comstock/Getty Images
What Is the Difference Between a Mobile Web Browser & a Desktop Browser?
Desktop Web browsers have come a long way since browsers first incorporated graphics in 1992. Today, websites include embedded video, streaming media,...
Difference Between W-2 & W-3 Forms
The primary difference between a W-2 and a W-3 is that a W-3 form is transmitted by an employer to the Social...
What Is the Difference Between Transitional Housing & a Rental?
Transitional housing is most often comprised of a bundle of services, including shelter, designed to bring homeless individuals closer to self-sufficiency. A...
What Is the Difference Between an Underline & an Underscore?
While some definitions list an underscore and an underline as the same thing, they are usually regarded as separate characters or tools...