1. 2015
    Jun
    27

    <!DOCTYPE> Declarations

    Posted By


    doctype declarations

    DOCTYPE is really a short name for Document Type Declaration. DOCTYPE is very important in web design because it defines what HTML tags you can use and how you implement the design of a web page.

    To better understand DOCTYPE you need a brief history. Each web browser manufacture like Microsoft (Internet Explorer) for instance, makes their product (web browser) to their own standards. This caused problems for web designers because to make sure you get some uniformity “cross browser compatibility”, you had to markup your web pages differently to meet the specific requirements of each web browser for the one website you were working on, for all major web browsers (Internet Explorer, FireFox [then called Netscape], Safari).

    At some point the World Wide Web Consortium (W3C), who’s mission is to lead the World Wide Web to its full potential by developing protocols and guidelines that ensure long-term growth for the Web, set standards that got widely accepted by web browser manufactures, setting in the uniformity in websites we see the across the various modern browsers. This resulted in each web browser having 2 modes, a default “quirks mode” set by the manufactures and “standards mode” set by W3C. Any web page you see without a DOCTYPE is being displayed in “quirks mode”

    You can define DOCTYPEs as instructions that are associated to a particular SGML or XML document with a Document Type Definition (DTD). The web browser layout engine in modern browsers looks for the DOCTYPE and if it exists uses it to interpret how to display the HTML markup on the web page.

    To use a DOCTYPE is must declare it in the very first line of the HTML document right before the HTML tag like so

    
    <!DOCTYPE html>
    <html>
        <head></head>
        <body></body>
    </html>
    

    Below are some of the popular DOCTYPE declarations.

    HTML 4.01 Strict

    This DTD contains all HTML elements and attributes, but does NOT INCLUDE presentational or deprecated elements (like font). Framesets are not allowed.

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

    HTML 4.01 Transitional

    This DTD contains all HTML elements and attributes, INCLUDING presentational and deprecated elements (like font). Framesets are not allowed.

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

    HTML 4.01 Frameset

    This DTD is equal to HTML 4.01 Transitional, but allows the use of frameset content.

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

    XHTML 1.0 Strict

    This DTD contains all HTML elements and attributes, but does NOT INCLUDE presentational or deprecated elements (like font). Framesets are not allowed. The markup must also be written as well-formed XML.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    XHTML 1.0 Transitional

    This DTD contains all HTML elements and attributes, INCLUDING presentational and deprecated elements (like font). Framesets are not allowed. The markup must also be written as well-formed XML.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    XHTML 1.0 Frameset

    This DTD is equal to XHTML 1.0 Transitional, but allows the use of frameset content.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

    XHTML 1.1
    This DTD is equal to XHTML 1.0 Strict, but allows you to add modules (for example to provide ruby support for East-Asian languages).

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    HTML 5

    <!DOCTYPE html>

    XHTML MOBILE PROFILE

    It is an XHTML document type defined by the Open Mobile Alliance. XHTML-MP is derived from XHTML Basic 1.0 by adding XHTML Modules, with later versions of the standard adding more modules.

    Below are some of the mobile DOCTYPE declarations.

    XHTML Mobile 1.0

    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
    "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

    XHTML Mobile 11

    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.1//EN"
    "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd">

    XHTML Mobile 12

    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN"
    "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">

  2. About Emeka Echeruo

    Emeka Echeruo

    I love sports, football which I refuse to call soccer, and the outdoor especially walks in park. Software development is my passion, there is a beauty in creating something out of nothing but algebra that ends up becomes a part of a persons daily life. I love kids, dogs, nightlife and art because it finds you and moves you emotionally!

  3. Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.