Results 1 to 3 of 3

Thread: DTD HTML VS DTD XHTML in scripts

  1. #1
    Join Date
    Oct 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DTD HTML VS DTD XHTML in scripts

    1) Script Title: Omni SLide Menu

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...lide/index.htm

    3) Describe problem: I use a website development program called webplus and when it publishes html it uses DTD HTML 4.01 Transitional..

    The above script will work fine with my website in firefox, but when i view it in explorer it won't. If I change the DTD HTML 4.01 TO DTD XHTML 1.0 like it is in the DEMO.HTM file that comes witht the script, it works perfectly, and so does my website "appear to" . my question is whether this is a good idea?

    From my understanding xhtml 1.0 is equivelent to html 4.01. Is This correct?

    Some insight would be greatly appreciated..

    Bob

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There's a difference between the DTD and the DOCTYPE. The former is a body of rules for the latter. The http://www.w3.org/ website maintains these rules.

    With HTML DOCTYPE's less than 5 one must specify the URL of the DTD on the w3.org site, example:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    Otherwise IE is in what's known as quirks mode. The menu's generated markup and script code (and many other scripts and markups) do not work well in quirks mode in IE.

    All XHTML DOCTYPE's have a URL for the DTD, so if you have a valid XHTML DOCTYPE, you are in standards mode.

    Alternatively you may use the very simple HTML 5 DOCTYPE:

    Code:
    <!DOCTYPE html>
    which triggers standards mode without a DTD URL in the DOCTYPE.

    There is some debate over which is best. Generally though, if you are not serving a true xml page (which if you were, would not work in IE anyway), you should use an HTML DOCTYPE.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    <!DOCTYPE html> is simplest. The only thing you really need a doctype to do is trigger standards-compliance mode, anyway.

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
  •