Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2013
    Location
    Noida, Chandigarh
    Posts
    4
    Thanks
    0
    Thanked 1 Time in 1 Post

    Doctype and its Types

    Hi

    I would like to ask What is Doctype and how many its types and when should we use each one?

    Thanks
    balkar

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,606
    Thanks
    6
    Thanked 997 Times in 970 Posts
    This should give you a good explanation: http://www.w3.org/QA/Tips/Doctype

    And the only doctypes that are relevant today for new websites are HTML and XHTML strict and the HTML 5 doctype (although this isn’t even a real doctype declaration).

  • #3
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,694
    Thanks
    0
    Thanked 232 Times in 227 Posts

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,589
    Thanks
    0
    Thanked 644 Times in 634 Posts
    For all pages using the current HTML standard you should use the following doctype.

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

    If you are using XHTML instead of HTML then the current doctype is:

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

    The new versions of HTML and XHTML due to become the standard next year are no longer based on SGML and so don't actually use a doctype but for HTML 5 you still need to include <!DOCTYPE html > to stop the browser going into quirks mode. XHTML doesn't have a quirks mode so there is nothing need be included for XHTML 5.

    All doctypes other than the above three are for web pages written using earlier versions of HTML that have been obsolete since 1997.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •