Which Doctype to use?

Discussion in 'HTML & Website Design' started by jcMarkus, Mar 4, 2011.

  1. #1
    Ok as far as I know, there are 3 different Doctypes.

    • HTML 4.01 Strict
    • HTML 4.01 Transitional
    • HTML 4.01 Frameset
    I have a few questions now...

    1) Which one to use? Strict or Transitional?

    2) Where would I play the Doctype code? Before the <html> tag or inside it?

    3) Would I use the same Doctype code for each website? For example if I wanted to go with Traditional, would I just copy and paste this code on every site and I'm done with Doctypes?
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd"> 
    Code (markup):
     
    jcMarkus, Mar 4, 2011 IP
  2. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #2
    1. It's upto you. However, code has to comply what these doctype needs to validate.
    2. Docytype should be the very first line of the document.
    3. Again depends on you and your need to validate your document with a specific doctype. Not sure what you meant by "Traditional" however yes the same doctype can be copied and paste to another document.
     
    Last edited: Mar 4, 2011
    radiant_luv, Mar 4, 2011 IP
  3. developerpanda

    developerpanda Peon

    Messages:
    104
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Its the age of HTML5. You don't need those lengthy DOCTYPEs anymore, just start with

    <!DOCTYPE HTML>
    <html lang="en">
    <head>
      <meta charset="UTF-8"/>
      <title>Page Title</title>
    </head>
    <body>
    </body>
    </html>
    Code (markup):
     
    developerpanda, Mar 4, 2011 IP
  4. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #4
    Modern web pages have no need for "transitional" and it should not be used. ALL new pages should use strict or, as @developerpanda pointed out, the new HTML doctype.
     
    drhowarddrfine, Mar 5, 2011 IP
  5. Divisive Cottonwood

    Divisive Cottonwood Peon

    Messages:
    1,674
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Don't forget XHTML...

    But nevertheless just use HTML5 now: <!DOCTYPE html>

    And that's it!
     
    Divisive Cottonwood, Mar 5, 2011 IP
  6. AtSeaDesign

    AtSeaDesign Active Member

    Messages:
    172
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    93
    #6
    Regarding the new doctype. Does IE handle this okay? I assume all the real browsers do fine but wondering about IE.
     
    AtSeaDesign, Mar 5, 2011 IP
  7. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #7
    Yes. Chris Wilson, lead developer for IE (who quit Microsoft and now works on Google Chrome), said a couple years ago that IE automatically goes into strict mode with this doctype.
     
    drhowarddrfine, Mar 5, 2011 IP
  8. AtSeaDesign

    AtSeaDesign Active Member

    Messages:
    172
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    93
    #8
    thx. :) How funny that even the LEAD developer left. haha
     
    AtSeaDesign, Mar 5, 2011 IP