Results 1 to 6 of 6

Thread: doctypes -- default/best?

  1. #1
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default doctypes -- default/best?

    I realize that a doctype is used to offset a "special" encoding, like xml, etc.

    However, what I'm not too sure of is what to use for my "normal" sites.

    The default, according to w3schools, doesn't allow for all the commands i'm using, but at the same time, they obviously exist.

    What's the default/best/normal doctype?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    I use the xhtml transitional doctype for the most part, since it's the most realistic one to use right now for normal webpages IMO. It clearly conforms to web standards while still allowing for some essential HTML attributes like "target" of A elements:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    But I don't need xml. I mean... sure, cool thought, but I didn't even think that was allowed in IE.

    Is there a more basic one with as much functionality (except xml commands)?

    Or would others agree this is the best?

    I really don't know... just trying to figure it out.

    Thanks.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    XHTML Transitional should never be used to design a site. It totally defeats the point of using XHTML in the first place.

    XHTML 1.1 Strict is theoretically the best DOCTYPE. Unfortunately, it has several disadvantages (mostly IE's total lack of support and bungling attempts to parse it as HTML) that make it unrealistic. See Sending HTML as text/html Considered Harmful for more information.

    Therefore, HTML 4.01 Strict is really the only DOCTYPE you should be using. There are some cases where XHTML is appropriate, but never send XHTML if IE could be accessing the page, and always send it as application/xhtml+xml.

    Oh, and, insofar as I know, functionality has never been removed from a DOCTYPE. If a certain method of accomplishing something has been removed, it's because there is an equivalent. In the case of the "target" attribute, that would be client-side scripting.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Twey, what would that doctype be, then; the code? (html 4.01)
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    Another alternative suggested to me recently is to serve XHTML as application/xml, then construct a stylesheet for it from scratch that replicates what browsers should do. That way, when support grows, all you need do is change the content type and remove the stylesheet, and you'll have a valid, working XHTML page. It's a lot of work though.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •