What Is the Difference Between Transitional & Strict XHTML?

Save

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.

Doctype

  • 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&#8221;>

    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&#8221;>

    Most Web developing software will insert the Doctype when you begin a new HTML document. However, you can still change the DTD version.

XHTML

  • 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.

Transitional Doctype

  • 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.

Strict Doctype

  • 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.

References

  • Photo Credit Comstock/Comstock/Getty Images
Promoted By Zergnet

Comments

Resources

You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!