SitePoint Sponsor

User Tag List

View Poll Results: Which DOCTYPE Do You Use?

Voters
36. You may not vote on this poll
  • HTML 4.01 Strict

    17 47.22%
  • HTML 4.01 Transitional

    3 8.33%
  • HTML 4.01 Frameset

    0 0%
  • XHTML 1.0 Strict

    15 41.67%
  • XHTML 1.0 Transitional

    10 27.78%
  • XHTML 1.0 Frameset

    0 0%
  • XHTML 1.1

    0 0%
Multiple Choice Poll.
Page 1 of 2 12 LastLast
Results 1 to 25 of 36
  1. #1
    SitePoint Evangelist artcoder's Avatar
    Join Date
    Aug 2005
    Location
    Planet Earth
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Which doctype do you use?

    Which doctype do you use? HTML4.0 or XHTML1.0? And why?

    This question was prompted by this post in another thread.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,608
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Unless you have a specific reason for selecting a different doctype you should always use HTML 4.01 strict.

    You should only ever use a transitional doctype to support old pages you haven't had time to rewrite to validate as strict yet.

    You should only ever use an XHTML doctype if you have a proper understanding of the difference between HTML and XHTML and have a specific reason why you want to use XHTML - remembering that IE8 (and probably IE9) do not support XHTML at all unless you serve it as malformed HTML.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Evangelist Karpie's Avatar
    Join Date
    Jul 2007
    Location
    Perth, Australia
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For personal work, HTML 4.01 Strict.

    For business work, XHTML 1.0 Transitional (not my choice).

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Unless you have a specific reason for selecting a different doctype you should always use HTML 4.01 strict.
    +1

    Quote Originally Posted by felgall View Post
    remembering that IE8 (and probably IE9) do not support XHTML at all unless you serve it as malformed HTML.
    Even then they don't support XHTML, they just support badly written HTML. They also support XML (if you serve XHTML as application/xml), so you can use XML features if necessary, but they still don't support XHTML.
    Birnam wood is come to Dunsinane

  5. #5
    SitePoint Evangelist croatiankid's Avatar
    Join Date
    Mar 2007
    Location
    Zagreb, Croatia
    Posts
    409
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use HTML 4.01 (strict) except if my employer tells me to use XHTML.

    You could've made this a poll.
    Hrvoje Markovic
    Croatiankid designs

  6. #6
    SitePoint Evangelist artcoder's Avatar
    Join Date
    Aug 2005
    Location
    Planet Earth
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    remembering that IE8 (and probably IE9) do not support XHTML at all unless you serve it as malformed HTML.
    What about IE7 and Firefox? I'm not sure what you mean by "serve it as malformed HTML". I see pages using XHTML 1.0 Transitional and they seem render fine in IE6, IE7, and Firefox and all the major browsers.

    Is this more of an academic questions rather than a practical question? In other words, is selecting the doctype only matter during W3C validations. But if I only care about how about my page renders to the users, then all major browsers can render it fine regardless of whether what doctype I use. Correct?

    Is there any examples where using the wrong doctype will cause the page to render inproperly to the user?

  7. #7
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by croatiankid View Post
    You could've made this a poll.
    Look above.

    (I added one.)

  8. #8
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,608
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by artcoder View Post
    What about IE7 and Firefox? I'm not sure what you mean by "serve it as malformed HTML". I see pages using XHTML 1.0 Transitional and they seem render fine in IE6, IE7, and Firefox and all the major browsers.
    If you actually serve your web pages as real XHTML using an application/xml-xhtml mime type instead of the text/html mime type that is used for HTML then Internet Explorer 5, 5.5, 6, 7, 8, and probably 9 and 10 will offer the file for download because they do not know how to display it. Only by using a text/html mime type can you get the page to display in IE and then the closing slashes in singleton tags are invalid regardless of what the validator says because you have HTML and not XHTML. Ther doctype doesn't identify whether the page is HTML or XHTML, the mime type does. Most pages with an XHTML doctype are still served as HTML rather than XHTML.

    The easiest way to see this is to remove the spaces in front of those closing slashes as they are unnecessary in real XHTML and are only there to allow the page to be served as HTML without the slash causing the preceding attribute to be ignored as an error in the HTML. By adding the space only the slash itself is an error to be ignored rather than making the last attribute into an error as well.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  9. #9
    SitePoint Evangelist artcoder's Avatar
    Join Date
    Aug 2005
    Location
    Planet Earth
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, okay. That's makes sense now. Thanks for the clarification.

  10. #10
    SitePoint Enthusiast
    Join Date
    Oct 2007
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XHTML 1.0 Transitional ,
    seems more compatible with previous works.


    Mattcch2007
    matt

  11. #11
    SitePoint Wizard bronze trophy Black Max's Avatar
    Join Date
    Apr 2007
    Posts
    4,029
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    I've read on some guru sites that in general, you should use the XHTML 1.0 Transitional doctype. Other sites argue quite convincingly for the HTML 4.0 Strict. I think our redesign is going to be in the former. Anyone want to say why XHTML Transitional is a good overall choice--or dispute it? I'd like to know before we get too far into the coding.

  12. #12
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Black Max View Post
    I've read on some guru sites that in general, you should use the XHTML 1.0 Transitional doctype.
    If someone advocates XHTML 1.0 Transitional, I wouldn't consider them a 'guru' (at least not a markup guru).

    Transitional doctypes are not meant to be used for creating new documents at all. Their purpose is for modernising pre-HTML4 documents. If you've got an HTML2 or HTML3.2 document that you want to bring into the 21st century, the idea is that you can put a Transitional doctype declaration in it, temporarily, during a transitional phase, to allow you to validate the markup. Then you're supposed to get rid of the presentational markup and replace it with CSS. Finally, you replace the Transitional doctype declaration with a Strict one and make sure it still validates.

    I cannot comprehend the reason for XHTML 1.0 Transitional. It's an oxymoron. People supposedly use 'XHTML' to be modern and 'future proof'. If so, why do they need a Transitional doctype that allows bad-practice old-school stuff that's been deprecated for a decade?
    Birnam wood is come to Dunsinane

  13. #13
    SitePoint Wizard bronze trophy Black Max's Avatar
    Join Date
    Apr 2007
    Posts
    4,029
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    Transitional doctypes are not meant to be used for creating new documents at all. Their purpose is for modernising pre-HTML4 documents. If you've got an HTML2 or HTML3.2 document that you want to bring into the 21st century, the idea is that you can put a Transitional doctype declaration in it, temporarily, during a transitional phase, to allow you to validate the markup. Then you're supposed to get rid of the presentational markup and replace it with CSS. Finally, you replace the Transitional doctype declaration with a Strict one and make sure it still validates.
    That is exactly my understanding. But, I'm not an expert, so I didn't know for sure. Glad to see a Voice of Authority validate my own viewpoint.

    Quote Originally Posted by AutisticCuckoo View Post
    I cannot comprehend the reason for XHTML 1.0 Transitional. It's an oxymoron. People supposedly use 'XHTML' to be modern and 'future proof'. If so, why do they need a Transitional doctype that allows bad-practice old-school stuff that's been deprecated for a decade?
    Exactly. So, for the record, your rule of thumb is HTML 4.01 Strict except in specific, defensible instances?

  14. #14
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for bringing up this topic. I always feel that it's very important to deal with it before creating any webpage .
    Software development company, offshore software development

  15. #15
    Now available in Orange Tijmen's Avatar
    Join Date
    Jul 2004
    Location
    The Netherlands
    Posts
    1,472
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Unless you have a specific reason for selecting a different doctype you should always use HTML 4.01 strict..
    Thats what I do as well. Its really amazing how many people choose a doctype without considering what it means.
    Travel Photos on Flickr - Twitter

    “Never give up. Never surrender”

  16. #16
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Black Max View Post
    So, for the record, your rule of thumb is HTML 4.01 Strict except in specific, defensible instances?
    Yes. The WCAG 1.0 guidelines say that we should 'create documents that validate to published formal grammars' (checkpoint 3.2, priority 2), 'use W3C technologies when they are available and appropriate for a task and use the latest versions when supported' (checkpoint 11.1, priority 2) and 'avoid deprecated features of W3C technologies' (checkpoint 11.2, priority 2).

    HTML 4.01 is the latest recommendation with widespread support and the Strict DTD is the only one that's not deprecated.
    Birnam wood is come to Dunsinane

  17. #17
    I Love Licorice silver trophybronze trophy Datura's Avatar
    Join Date
    Aug 2006
    Location
    Florida USA
    Posts
    5,775
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Since I have gotten into coding now, I have used HTML 4.01 Strict because of what I have learned here on Sitepoint from the people I have judged to be in the know.

    The term *Transitional* gives itself away by its meaning, so I would have never chosen that for starting a new site.
    Ulrike
    TUTs: 1 2 3 4 5 6 7 8 9 10

  18. #18
    hi galen's Avatar
    Join Date
    Jan 2006
    Location
    New Haven, CT
    Posts
    1,228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sitepoint is xhtml transitional

  19. #19
    hi galen's Avatar
    Join Date
    Jan 2006
    Location
    New Haven, CT
    Posts
    1,228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Come to think of it... If html 4.01 is the best doctype to use why do so many sites use xhtml?

    webmonkey - xhtml transitional
    a list apart - xhtml transiitional
    w3c - html 4 strict

    most of the more well known developer sites ive checked use some form of xhtml.

    Im not saying you guys are wrong, im just curious.

  20. #20
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by galen View Post
    Come to think of it... If html 4.01 is the best doctype to use why do so many sites use xhtml?
    They don't really use XHTML. They just use an XHTML doctype but serve the documents as text/html. That means they are really using invalid HTML.

    Why do they do it? Because they believe the hype that XHTML is 'better' than HTML (it isn't, they have exactly the same semantics). And because they don't understand the differences between XHTML and HTML. They actually believe they are reaping some sort of benefits from using XHTML markup even while serving it as HTML.

    Mainly I think it's because they want it to be true.
    Birnam wood is come to Dunsinane

  21. #21
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For text/html: <!doctype html>.
    For XML: No doctype.
    Simon Pieters

  22. #22
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some statistics on doctype usage in text/html:
    http://philip.html5.org/data/doctypes.html 130K dmoz pages
    http://philip.html5.org/data/doctypes-alexa.html Alexia top 500
    Simon Pieters

  23. #23
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,608
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    One reason for using an XHTML doctype with an HTML web page is that the validator for XHTML includes a number of checks that the HTML validator doesn't in connection with tags which the HTML standard say are optional (because the browsers need to handle when they are not there) but which SHOULD be mandatory in any created web page.

    One of the problems with the standards and the validators is that they only cover the part of the standards that is relevant to both browser writers and web page writers and leave out the other 60-70&#37; of the standards relevant to writing web pages. The XHTML validator checks slightly more of the FULL standards that a web page writer should be following than the HTML validator does because the XHTML standards require those tags that should always be included (they are not optional in XHTML). It also validates for consistency of the case used in writing your tags (all lowecase instead of allowing <HtMl> ).

    The disadvantage to doing that if you are still going to serve the page as HTML is that the XHTML validator also lets code through that is valid in XHTML but not HTML (such as <a id="here"/> ). Of course if you never write true XHTML code then that will not be a problem.

    What is needed in order to do away with the need to use a XHTML doctype with an HTML page in order to get a validator that does a slightly better job is a decent validator that can validate against the standards that web page writers need to follow rather than just those that the browser writers need to follow.

    Of course this is just one of several reasons why those who actually know the difference between HTML and XHTML might select to use an XHTML doctype. The vast majority of those using a XHTML doctype are probably doing so without knowing the difference. Whether this is the reason why A List Apart uses a XHTML doctype or whether there is a different valid reason for that site using it I don't know.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  24. #24
    SitePoint Wizard bronze trophy Black Max's Avatar
    Join Date
    Apr 2007
    Posts
    4,029
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Whether this is the reason why A List Apart uses a XHTML doctype or whether there is a different valid reason for that site using it I don't know.
    If I recall correctly (and I may not), it was an ALA article that was one I saw recommending using the HTML 4.01 Strict doctype. If my memory is correct, it's interesting that they would promote one doctype and use another.

  25. #25
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    What is needed in order to do away with the need to use a XHTML doctype with an HTML page in order to get a validator that does a slightly better job is a decent validator that can validate against the standards that web page writers need to follow rather than just those that the browser writers need to follow.
    In order to increase the chance of getting it implemented in a decent validator, could you elaborate on what you think the standards that web page writers need to follow are, exactly? I've noted optional tags and case consistency. Anything else? Consistency with " vs '? Consistency with /> vs >?
    Simon Pieters


Bookmarks

Posting Permissions

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