Fix Your Site With the Right DOCTYPE!

You’ve done all the right stuff, but your site doesn’t look or work as it should in the latest browsers.

Article Continues Below

You’ve written valid XHTML and CSS. You’ve used the W3C standard Document Object Model (DOM) to manipulate dynamic page elements. Yet, in browsers designed to support these very standards, your site is failing. A faulty DOCTYPE is likely to blame.

This little article will provide you with DOCTYPEs that work, and explain the practical, real–world effect of these seemingly abstract tags.

WHY A DOCTYPE?#section1

Per HTML and XHTML standards, a DOCTYPE (short for “document type declaration”) informs the validator which version of (X)HTML you’re using, and must appear at the very top of every web page. DOCTYPEs are a key component of compliant web pages: your markup and CSS won’t validate without them.

As mentioned in previous ALA articles (and in other interesting places), DOCTYPES are also essential to the proper rendering and functioning of web documents in compliant browsers like Mozilla, IE5/Mac, and IE6/Win.

A recent DOCTYPE that includes a full URI (a complete web address) tells these browsers to render your page in standards–compliant mode, treating your (X)HTML, CSS, and DOM as you expect them to be treated.

Using an incomplete or outdated DOCTYPE—or no DOCTYPE at all—throws these same browsers into “Quirks” mode, where the browser assumes you’ve written old-fashioned, invalid markup and code per the depressing industry norms of the late 1990s.

In this setting, the browser will attempt to parse your page in backward–compatible fashion, rendering your CSS as it might have looked in IE4, and reverting to a proprietary, browser–specific DOM. (IE reverts to the IE DOM; Mozilla and Netscape 6 revert to who knows what.)

Clearly, this is not what you want. But it is often what you’ll get, due to the preponderance of incorrect or incomplete DOCTYPE information this article hopes to correct.

(Note: The Opera browser does not play by these rules; it always attempts to render pages in standards–compliant mode. Go, Opera! On the other hand, Opera does not yet offer solid support for the W3C DOM. But they’re working on it.) {Ed: Since this article was first published, Opera has delivered the DOM-compliant Opera 7 browser.}

WHERE HAVE ALL THE DOCTYPES GONE?#section2

Since DOCTYPES are vital to the proper functioning of web standards in browsers, and since W3C is a leading creator of web standards, you might expect W3C’s website to provide a listing of proper DOCTYPEs, and you might also expect to be able to find this information quickly and easily in a single location. But as of this writing, you can’t. {Ed. Prompted in part by this article, the W3C now lists standard DOCTYPEs on its site. You will find the listing a few screens into the W3C tutorial, “My Web site is standard. And yours?”}

W3.org is not A List Apart, WebReference, or Webmonkey. It’s not intended to help web designers, developers, and content folks get up to speed on the latest technological recommendations and practices. That’s not its job.

W3C does publish a series of tutorials, though most web developers are unaware of it. Mainly, though, W3C’s site houses a collection of proposals, drafts, and Recommendations, written by geeks for geeks. And when I say geeks, I don’t mean ordinary web professionals like you and me. I mean geeks who make the rest of us look like Grandma on the first day She’s Got Mail.™

You can search for DOCTYPEs all day at w3.org without finding one page that lists them all. And when you do hunt down a DOCTYPE (generally in relation to a particular Recommendation or Working Draft), it’s often one that won’t work on your site.

Scattered throughout W3C’s site are DOCTYPEs with missing URIs, and DOCTYPEs with relative URIs that point to documents on W3C’s own site. Once removed from W3C’s site and used on your web pages, these URIs point to non–existent documents, thus fouling up your best efforts and the browser’s.

For instance, many sites sport this DOCTYPE, copied and pasted directly from w3.org:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">

If you look at the last part of the DOCTYPE (“DTD/xhtml1-strict.dtd”), you’ll see that it is a relative link to a document on W3C’s site. Since that document is on W3C’s site but not yours, the URI is useless to the browser.

The DOCTYPE you’d actually want to use is:

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

Notice that the latter DOCTYPE includes a complete URI at the end of the tag. Since the tag provides a valid location on the web, the browser knows where to find it, and will render your document in standards–compliant mode.

DOCTYPES THAT WORK#section3

So what DOCTYPEs should we use? Glad you asked. The following complete DOCTYPEs are the ones we need:

HTML 4.01 Strict, Transitional, Frameset#section4

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

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

XHTML 1.0 Strict, Transitional, Frameset#section5

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

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

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

XHTML 1.1 DTD#section6

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

NEXT STEPS#section7

How can you help improve support for standards on the web? Besides bookmarking this page (and copying and pasting these DOCTYPEs for your own use), if your web editor inserts DOCTYPEs, you might want to check them out and compare them to the list above.
Many well–intentioned software makers have cut and pasted incomplete DOCTYPEs from W3C into their software. Result: when you use these programs’ built–in functionality to insert DOCTYPEs in your pages, the browsers go into Quirks mode, undoing all your hard work.

It’s worth contacting the folks who make your favorite authoring package, showing them the proper DOCTYPEs, and politely requesting them to address this issue in an incremental upgrade. (In some cases, you may also be able to modify your editor yourself.)

COMING SOON#section8

We have every reason to believe that W3C’s site will soon sport a handy listing of accurate, usable DOCTYPES and other essential information in an easy–to–find location. In fact, Karl Dubost, Conformance Manager of W3C’s Quality Assurance team,  contributed to the information in this little article.

Likewise, when The Web Standards Project relaunches (real soon), it will also provide this information. {Ed. note: The Web Standards Project relaunched in late 2002.}

But sites are being designed and built every day, and you need this information now—so there it is.

Happy authoring and rendering!

190 Reader Comments

  1. IE6 triggers quirks mode if there is an XML declaration present. It requires the XHTML doctype to be the very first line to trigger standards mode.

  2. Copied directly from the article:
    < !DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN">
    “http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”>

    Should that have the ‘>’ after //EN” ? Looks like a typo, correct version at http://www.w3.org/TR/xhtml1/#normative (only the > is different). Great article as always!

    Some other good DOCTYPE resources:
    http://www.oreillynet.com/pub/a/network/2000/04/14/doctype/
    http://developer.apple.com/internet/html/doctype.html
    http://www.meyerweb.com/eric/dom/dtype/dtype-grid.html
    http://www.people.fas.harvard.edu/~dbaron/mozilla/quirklist (Good info about Mozilla quirks)

    Straight from the source:
    http://mozilla.org/docs/web-developer/quirks/ (I got a laugh out of some of the public identifiers 🙂
    http://msdn.microsoft.com/workshop/author/css/overview/cssenhancements.asp
    http://lxr.mozilla.org/seamonkey/source/layout/html/document/src/quirk.css (Mozilla’s quirks stylesheet! Gotta love the irony.)

  3. > IE6 triggers quirks mode if there is an XML declaration present.

    You’ve got to be kidding me. Is this seriously the case? Doesn’t the standard REQUIRE the XML declaration at the top, above the DOCTYPE tag? So, once again we’re thrown into the sitation of having to either write documents that comply with the standards or documents that work in popular browser, but we can’t have both at the same time. Sigh.

  4. I was playing around with the DTDs. When I used the xHTML strict listed in the article, I get an error stating
    “Fatal Error: unrecognized {{DOCTYPE}}; unable to check document” Am I doing something wrong or is this another problem I can blame GW. by the way my site validates as xHTML 1.1. have a nice day!

  5. No, the XML declaration is optional, as long as you specifiy the page’s character encoding using a Meta tag, the page will be valid XHTML, even XHTML 1.1

  6. good article – thanks, but I’m still unclear as to which doctype to use. The article lists the doctypes for Strict, Transitional, and Frameset, but what are these? – obviously the type of (X)HTML you’re using – but I’m only clear on what version number I’m using – not Strict, Transitional, or Frameset.

    Can anybody enlighten me?

  7. So someone clear up what the browser is actually doing when it wants a doctype. Is it actually going out to the URI you state in the doctype, fetching + parsing the information and changing the chartacteristics of it’s rendering because of this? or, is the browser just matching the doctype it sees on the top of your html document to a list of known doctypes it stores and does it that way.

    It just seems peculiar that the W3C will allow every single webpage in existence that has a doctype pointed to it to use it’s resouces. Does anyone see the problem with that? (network latency, general download time)

    What if, like Netscape did with I believe the RSS doctype, they just decide to move, and tweak it. We’d be quite up the river with no paddle. It also doesn’t make much sense to make web developers to post a doctype locally on a site and make them call the doctype from there. It makes something that should be soooo simple much too complex.

    Viddying the doctype itself doesn’t really shed much light on what it actually does.

    sort of odd that HTML 4.01 would have a doctype, since aren’t doctypes one of those XML things? 🙂

  8. Nice article, I already knew where the DOCTYPEs were located in the site. But, it’s true; it’s a virtual Indiana Jones type quest just to find them.

    Anyway, this article came MINUTES after I was just putting the final touches to a CMS (Content Management Site). At least it’s good to know that I did everything right.

    Now, it’s Miller Time!

  9. “So someone clear up what the browser is actually doing when it wants a doctype. Is it actually going out to the URI […]? or, is the browser just matching the doctype it sees on the top of your html document to a list of known doctypes […]”

    Pretty unlikely that a browser actually cares whether the URI is valid or not, let alone what’s inside it.

    “What if, like Netscape did with I believe the RSS doctype, they just decide to move, and tweak it.”

    That’s why they won’t move it 😉

  10. Is there a reason why everyone puts the DOCTYPE declaration on two lines (the URI on the second)? Or is it just because it’s supposed to be easier to read?

  11. >> IE6 triggers quirks mode if there is an XML declaration present.

    > You’ve got to be kidding me. Is this seriously the case?

    Unfortunately, it is. I’ve confirmed it on my own. The only way to trigger “standards” mode in IE6 is to forego the use of the XML declaration.

    > Doesn’t the standard REQUIRE the XML declaration at the top, above the DOCTYPE tag?

    If you use both an XML declaration and a DOCTYPE, the XML declaration *must* be on the first line, followed by the DOCTYPE on the second line. But as riffola said, you can lose the XML declaration if you specify the document encoding type in a element. This may not be ideal, but it’s a valid workaround. Our salvation is that Microsoft will have released a new browser version by the time the next version of XML is released and we’re forced to use an XML declaration to comply.

    > Is there a reason why everyone puts the DOCTYPE declaration on two lines (the URI on the second)? Or is it just because it’s supposed to be easier to read?

    It’s easier to read. Like most anything in XML, the amount of white-space between different parts of an element (element names, attributes, etc.) is irrelevant so long as there is any amount. You can have a dozen spaces, five tabs, and 16 line breaks between each element part and the parser won’t care.

  12. Thanks much for the clarity Greg. I’ve been searching for the answer to the xml-declaration-IE-quirks-mode bug for some time, and had no idea that it could be so obvious a solution.

    Good article as well: concise, and informative.

  13. > sort of odd that HTML 4.01 would have a doctype, since aren’t doctypes one of those XML things? 🙂

    Nope…they’re one of those SGML things. Even HTML 3.2 has a DOCTYPE.

    Another thing that’s been bugging me:

    BBEdit likes to use DOCTYPES like this (for XHTML 1.0 Transitional, for example):

    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">

    which, if you bother to go to the URL specified, contains a proper XHTML DTD (the same one, I’m fairly certain, as if you go to the URL specified in the article). This URL causes browsers to enter standards mode (good), and is valid according to the W3C (X)HTML validator (also good). However, when one attempts to run a page with this DOCTYPE through the W3C’s CSS validator, it chokes, proclaiming it an invalid DOCTYPE (which it clearly is not).

    Annoying.

  14. There´s one thing I don´t understand about this one:

    Does the lang=”en” elements refer to the language used in the document? Do I have to write lang=”fr” if there´s french text on the page?

  15. Wonderful comments, and thanks for catching the typo, Matthew.

    Several questions raised here are answered in documents linked from the article.

    For instance, the optional xml prolog causes problems in many browsers, not just IE6. Though it’s part of the XHTML standard, it’s an OPTIONAL part, precisely because its use causes problems in old browsers as well as some new ones.

    This is covered in more detail in the XHTML Guidelines section of the NYPL Style Guide: http://www.nypl.org/styleguide/xhtml/guidelines.html

    The Style Guide is linked from the article, and the XHTML Guidelines section is linked from “Better Living Through XHTML” (which is linked from the article).

  16. now that we can render in a more compliant way, does anyone know when we can expect to see a strictly rendering browser?

    as a developer, i would personally like a developer version of a browser which takes no crap from me and chokes up and any non-compliant mark-up. really i’d like it to help me force the developers i work with into doing basic stuff like closing tags and proper nesting 😛

    seriously though, has anyone heard of such a user-agent? i’ve played with amaya (from the w3c), but its results are sometimes bafling and i wonder how correct they are.

  17. I’m sorry, but all this article does is complain about how so many Web sites don’t use proper doctypes, then goes and provides a list of doctypes, that were already available in many other places on the Web. Where’s the beef, Zeldman?

    A perfect example:

    IE reverts to the IE DOM; Mozilla and Netscape 6 revert to who knows what.

    Umm, well, why don’t you ask them? This is called “Lazy author’s syndrome,” and is consistent with many articles you find online. It’s when the author is too lazy to either find out the complete information and provide a much more robust and helpful article, or to simply leave out the unhelpful snide remarks.

    Where is the discussion about all those folks who are using incorrect doctypes on purpose? I know some big-name shops (such as IBM) where the DOCTYPE tag is purposely incomplete so they can get IE-specific features like changing scrollbar colors.

    I’m disappointed by this article. It looks like a combination rant and cut-and-paste from other places on the Net, and is trying to pass for something semi-original. It’s not. It’s a hack job at it’s worst.

  18. Two hours before this article went live, I was contacted by a standards-aware developer who wondered if I knew why his carefully authored site was displaying incorrectly in Mozilla 0.9.9. I did. The answer was in this article. Despite all his knowledge and care, this developer had used the wrong DOCTYPE because that’s what he found at the source (W3C).

    The HTML editors I use contain incomplete DOCTYPEs that trigger Quirks mode in all standards-compliant browsers but Opera (which avoids DOCTYPE switching, per the article).

    These HTML editors are market-leading products, developed over years, by people who care about proper web authoring. They contain the wrong DOCTYPEs because a straightforward listing of proper DOCTYPEs is currently impossible to find at the source (W3C).

    W3C standards (and other standards) are essential to the growth of the web, but w3.org’s Information Architecture leaves something to be desired, as they will be the first to admit. And this is so for the reasons stated in the article (W3C is not a tutorial site, it’s a repository for a huge and growing collection of deeply geeky documents.)

    David, you may have known where to find all the proper DOCTYPEs, but I didn’t until I did the research for this article, and neither do many working web designers and developers (as well as some leading software makers). This article is intended as a service to the working designer and developer — folks who don’t have time to hunt down this information in various scattershot locations, and will appreciate its being made available in one place.

    Also, I think you’ve mistaken editorial focus for “laziness.” This little article is intended to do one thing: give readers the proper DOCTYPEs. They don’t need a multi-paragraph digression on what previous DOM Mozilla/Netscape 6 may revert to if the wrong DOCTYPE is used. All they need to know is that, with the right DOCTYPE, Mozilla/Netscape 6 will support the W3C DOM.

    If you’re looking for a more extensive and more detailed examination of web standards in browsers, you’ll find many such articles in the PREVIOUS STORIES section of this magazine.

  19. One way to play around with all the different DOCTYPES is to go to the W3C’s Validation page (http://validator.w3.org/) & paste in your URI. The page allows you to select different DOCTYPES in order to check the validity of the code you’ve written.

    Also, if you check the “Show Source” box, the exact DOCTYPE syntax will appear in the result for cut & paste fun.

    Great article – something that needed to be addressed. Thanks.

  20. Thanks for the helpful article. It answered several questions I had. But I’ve got one more.

    Does anyone know if there’s and advantage to copying the DOCTYPEs from W3C and posting them locally?

    Do the browsers actually go look at the W3C DOCTYPEs? Or are the browsers just reading the URIs like they would a

    tag? In which case posting the DOCTYPEs locally would render them useless.

  21. 1. Are you using embedded scripts? The example at the above URL uses a script tag with the comment-hiding trick. This will make a true XML parser ignore the entire script, as XML parsers cannot treat script and style tags as containing anything but XML. There are ways to make the comment-hiding hack work in both HTML and XML at the same time, but it’s not pretty. Try removing the comment hack or, best, using an external script instead.

    2. The script contains an ETAGO sequence (http://www.example.com/test“onmouseover=”alert(); . Let’s see if that does anything it shouldn’t!

    cheers!

  22. One hting I’ve never been able to figure out is whether or not the line wrap and the tab white space on the second line is required. For coding sake, espeically on my dnamic sites I’d prefer to have it all on one line.

    Also, another reader above asked if the browser actually goes to the url in question. I don’t think it does in certain cases (when you use the ones listed in the article) but does it if you put another address in there? That could be an issue one might need to consider on an intranet where the DTD might be on the other side of the firewall.

  23. Am I the only one who is havig trouble validating XHTML 1.0 Transitional documents using the provided DTD? I get Error: DTD did not contain element declaration for document type name if I don’t change the “DOCTYPE HTML PUBLIC to “DOCTYPE html PUBLIC”

  24. The Doctype given for XHTML 1.0 transitional creates errors in the W3C validation service. What gives? I used to get validation when using the Doctype that this article says is incorrect.

  25. it seems to me that the notion to use the W3’s website as the host in the URI is wrongheaded for two reasons. one, doing so causes the visiting user agents to reference the DTD on the W3’s website and thus costing the W3 a great deal of bandwidth. two, updating DOCTYPES on your website quickly becomes a function of N where N is the number of webpages you wish to validate; perhaps a potentially large and daunting number.

    i think a better solution would be not to change your DOCTYPEs at all, and instead upload a copy of the DTD to your website in a directory called “DTD”. (you may need to do this for every subdirectory that contains webpages you wish to validate properly.) that would seem to save on bandwidth for the W3C and save on work for you (isn’t it better to upload 3 files for 3 directories rather than modify some 20 odd files?).

    one other note. the transitional dtd is not small — 32k — and using it to validate your website might be a bandwidth concern for visitors as well. (would it make any validating webpages produced for the 5k a pipe dream?) it might be best for some to leave your webpage in quirks mode after all…

  26. I’m getting the same validation failures as J in the above post. It seems that with the doctype for XHTML 1.0 Strict at least ( I haven’t tested the others), it is critical to start with “

  27. Yup J, capitalization does matter. XML and XHTML are caps sensitive. The element and the element are different animals as far as an XML parser is concerned. So when you set the DTD to “DOCTYPE HTML PUBLIC” you are setting the doctype to an element that is not included in your DTD.

  28. It seems that there is a small error in the doctypes listed for xhtml strict? – after fixing our site with the proper doctype it stopped validating, the same problem listed by adamd. Changing the “HTML” to lowercase “html” seems to have fixed the problem.

  29. Everyone’s posting about the lowercase problem at once. My public apologies for not minding the not at the top and messing things up with html in my last post.

  30. Hey,
    Anyone else out there have more resources on JavaScript in XHTML? I’ve been fumbling with this issue for like two months, and annoying the ZMan with my emails Why doesn’t this work? Simply: when the valid xhtml page has no doctype, the JS works. When it has any sort of doctype, it doesn’t. See for yourself:
    briandigital.com/test/menuwithoutdoc.html
    menuwithhalfdoc.html
    menuwithdoc.html

    Any ideas? For me (on Mac) it only renders *and* functions right in Opera5. A Windows using friend says it works on some of his browsers.

    Please email if you find the answer, and I’ll come back and post anything that works (this isn’t the best place to discuss debugging my site, I know). Sorry if my plea annoys anyone. I’m sure at least Jefffery’s sick of me… 😉

  31. OK after some quick tests (and reading everyone else who’s joined in the debate) the three XHTML 1.0 doctypes should read as:

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

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

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

    Stick to the exact capitalization above to allow your pages to validate.

  32. “now that we can render in a more compliant way, does anyone know when we can expect to see a strictly rendering browser?”

    This is where XHTML, especially XHTML 2.0, is headed. When a web page is sent with the XHTML media type (application/xhtml+xml rather than text/html) the user agent passes it through an XML parser, and throws an error message if it isn’t well-formed XML.

    Mozilla 0.9.2, Netscape 6.1 and Opera 6 all support the XHTML media type (unfortunately Microsoft presently do not). Note that whilst they check for well-formedness, they don’t compare the document to it’s DTD the way Amaya does (ensuring the document is “type-valid”). Even so, it should go a long way to helping tidy up the messy tag soup that presently populates the web.

  33. Ouch. I’ve lowercased “html” in those XHTML DOCTYPEs per your comments and the lowercase “html” in ALA’s own XHTML DOCTYPE declaration.

    Several experts reviewed the article for accuracy before it went live. Nobody caught this error.

    Thanks for the essential input and a thousand apologies for the confusion.

  34. does anyone has experience what exactly mozilla/n6 does different in its standard mode? i had a problem with a mainly table based layout in which mozilla seemed to use a line-height for table cells which contained a 1px high image only if a DOCTYPE was given (and do the cell break to became like 10-15px high). in quirks mode the cell stayed 1px high. mac ie seemed to do a similar thing.

  35. I hit the hotkey to enlarge the text on ALA, and only *some* of the text changed size. Sure enough, right there in your stylesheet, the body slass is defined with pixel-sized fonts. Come on guys, how about a little nod to taking your own advice.

  36. Also worth mentioning: in the present version of Mozilla, simply hit CTRL+I (or click View -> Page Info) to find out whether the page is being rendered in standards compliant mode or in backwards-compatibility mode. This feature will find it’s way into the next major release of Netscape before too long (post Netscape 6.2x)…

  37. First of all, a very good article indead .
    I must apologize for my writing of english which is far then good.
    So , I have a problem when validating my page on the w3 validator but the same page validate well-formed XHTML 1.0 with the WDG validator, so what is wrong with ???
    Any idea?

    The Doctype on my page :

    < ?xml version="1.0" encoding="ISO-8859-1"?>
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//FR" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    Document

    That’s what the W3 validator gives back :

    Warning: DOCTYPE Override in effect! Any DOCTYPE Declaration in the document has been supressed and the DOCTYPE for «XHTML 1.0 Transitional» inserted instead.
    The document will not be Valid until you alter the source file to reflect this new DOCTYPE.
    Below are the results of checking this document for XML well-formedness and validity.

    What does that mean? I really don’t know.

    Please note that you have chosen one or more options that alter the content of the document before validation, or have not provided enough information to accurately validate the document.
    Even if no errors are reported below, the document will not be valid until you manually make the changes we have performed automatically.
    Specifically, if you used some of the options that override a property of the document (e.g. the DOCTYPE or Character Encoding), you must make the same change to the source document or the server setup before it can be valid.
    You will also need to insert an appropriate DOCTYPE Declaration or Character Encoding (the “charset” parameter for the Content-Type HTTP header) if any of those are missing.

    No errors found! *

    This document would validate as the document type specified if you updated it to match the Options used.

    Is this a problem of language because I use “FR” instead of “EN”, don’t know?
    Can someone help me with that.

  38. I have been having a problem with a table layout falling literally to pieces in Netscape 6 because of the lack of a DOCTYPE, then with a valid DOCTYPE.

    < !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">

    If I use the valid DOCTYPE, it falls apart. If I use the above DOCTYPE, it all goes together perfectly.

    I can’t remember where I first heard this (I believe it was from a friend who possibly read it at evolt.org), however recent testing (two days ago) shows this is still the case for Netscape 6.2.

    Anyone know why?

  39. http://pun.org/ seems to validate fine, but I have issues with some of my pages where I use URLs that have “&” characters in them. Is there a straightforward way of escaping those strings so they’ll still be usable from 4.x browsers?

    –jrp

  40. Blondinnet — I think the W3C validator failed to detect your character encoding because you missed out the element around your element. Try the following:

    < ?xml version="1.0" encoding="ISO-8859-1"?>
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//FR" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



    Document

    Document


  41. Correction to the above! You should have the PUBLIC identifier “-//W3C//DTD XHTML 1.0 Transitional//EN”, and NOT “-//W3C//DTD XHTML 1.0 Transitional//FR”! (The EN refers to the language the DTD is written in, not the language your XHTML file is written in.)

  42. Blondinnet,

    on the validation page you may choose a doctype or you may let the validator figure out the doctype from the webpage you wish to validate. from the output it seems as though you’d chosen a doctype on the page rather than let it figure it out. it’s probably better not to specify one.

    suzanne,

    i seem to remember a “loose” dtd for html4. according to this page ( http://www.w3.org/TR/html4/struct/global.html ), the transitional dtd was, in the past, called loose.dtd. i figure loose.dtd would be a copy of transitional.dtd for xhtml, but i suppose not?

    jeffrey and waferbaby,

    could i ask a favor of you guys? a preview button would be a nice feature, if only to see who’s posted in-between the time i begin to write and the time i click on the post button…

  43. < ?xml version="1.0" encoding="ISO-8859-1"?>
    I have deleted the line above refering to xml

    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//FR" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    the same thing here deleting line with namespace refering
    xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”fr” lang=”fr”>


    Document

    And it validate this time oups!
    So the code I use is :

    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//FR" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    Document

    Thanks for the answers

  44. Regarding the DOCTYPE fetching issue, I believe each browser keeps a very small library of known DOCTYPEs against which it compares the DOCTYPE listed in your documents. If the DOCTYPE in your document matches one in their library of “standard” DOCTYPES, the browser reverts to standards mode. If your document contains no DOCTYPE or contains a “non-standard” one, the browser will revert to quirks mode. If your DOCTYPE does not contain a valid URI to the associated DTD, it’s not going to be one of the DOCTYPEs in the browser’s library and your documents will thus be rendered in quirks mode.

    Browsers do NOT need to retrieve external DOCTYPEs. Firstly, it would put tremendous strain on any servers containing centralized DTD files (such as the W3C’s servers at MIT). Secondly, it would increase the download time because it would have to acquire the DTD file from the external server. Then the browser would have to parse the DTD, compare the document against the newly acquired and parsed DTD, then decide in which mode the document should be rendered, and finally render the document.

    So the browser makers cheat a little. They simply figure out ahead of time that documents with DOCTYPES of a certain type shoud be rendered in a certain mode. So when the time comes to render a document, it compares the document’s DOCTYPE against the few stored in its library, figures out the mode in which to render the document, and renders it. This forces developers to use a small number of acceptable “official” DOCTYPEs (though no W3C DTD is technically official), but it reduces tremendously the overhead required to render each document.

    On a related note, here are a couple more DOCTYPEs you may find useful that weren’t listed in the article. I have tested these and confirmed them to be correct:

    XHTML 1.1 Plus MathML 2.0:
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">

    XHTML 1.0 Basic:
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">

  45. One thing I forgot to mention in my above post is that current browsers include XML parsers but not validators. IE’s most recent parser revision, MSXML 4.0, will check an XML document for well-formedness but not validity. For this reason, it is unnecessary for the browser to retrieve any DOCTYPE. At this time, fetching an external DOCTYPE would simply create additional bandwidth overhead when loading any page with a DOCTYPE.

    Further, XHTML documents aren’t currently checked for well-formedness by XML parsers because XHTML documents have a MIME type of “text/html”, which means they’re considered HTML documents by the browser, not true XML documents. Were XHTML to get its own MIME type–say, “text/xhtml+xml”–the browsers would be forced to parse the document and check it for well-formedness. Until this happens, XHTML documents will be checked for neither well-formedness or validity.

  46. Hi,

    don’t flame Jeffrey, I re-read the article and I didn’t see that one. It was part of my own fault. 🙂 and it was so obvious !!! in XHTML all elements are lowercase and so the root too… :))

    Errare Humanum Est

    At least now the article is fixed, and all people could do the right job!!!

    + Blondinet -> Your error is here

  47. I don’t mean to derail the thread, but I would just like to mention how increadibly charming it is that the W3C Conformance Manager writes with lots of !’s and :)’s. You just made me smile for the first time today. Thank you.

  48. In reference to Dave’s comment above about different separators I just wanted to note that for those of you using PHP it is not enabled by default. If you have access to your php.ini file (or have a nice host) look for these lines:

    ; List of separator(s) used by PHP to parse input URLs into variables.
    ; Default is “&”.
    ; NOTE: Every character in this directive is considered as separator!
    ;arg_separator.input = “;&”

    Simply uncomment the last line and both of those characters will function as argument separators. If you’re feeling rambunctious next April Fools try putting a character like “=” or “e” in there ;-p.

  49. Riffola:
    >No, the XML declaration is optional, as long as you specifiy
    >the page’s character encoding using a Meta tag, the page
    >will be valid XHTML, even XHTML 1.1

    But in the W3C spec (http://www.w3.org/TR/xhtml1/#docconf):
    “XHTML document authors are strongly encouraged to use XML declarations in all their documents. Such a declaration is required when the character encoding of the document is other than the default UTF-8 or UTF-16.”

    I’m a bit confused. I (prefer to) write my xhtml code using the swedish accented caracters, åäö. In order to do this I use a meta tag to declare that the caracter set is western european:

    So my question is: is “charset” in the meta tag the same as the “character encoding” in the w3c specification?

    And if so, am I right to conclude that I’ll have to set the caracter set to UTF-8 and start escaping all accented characters, in order not to be forced to make the xml-declaration?

  50. I also use ISO-8859-1, and tend to put the XML declaration in.
    Which browsers have problems with this? Obviously it’ll kick IE6 into quirks mode (not the end of the world as the sites need to work in IE5/5.5 anyway so it’ll behave similarly), but other than that I’ve not seen any definite information or received any complaints from clients/users (of course, if someone can’t use the site at all they’re unlikely to be able to find out where to complain to).

  51. The browser does *not* generally go to the URL referenced in the
    system identifier. This is partly because any XHTML browser would
    certainly already know what the public identifier
    ‘-//W3C//DTD XHTML 1.0 Strict//EN’ refers to and would not need to
    download the DTD. But mostly it’s because current browsers don’t
    actually give a stuff what you put in the system identifier. They
    doesn’t dereference it and they don’t even currently look at
    what it is for DOCTYPE switching – they only care that it’s
    there at all.

    This could become a bigger problem if true XHTML browsers are
    released which will attempt to dereference the URL if they don’t
    recognise the public identifier, and then a new version of XHTML
    is released with an unrecognised public identifier. Then all
    browsers would hit the W3 site at least once to download the DTD.
    They would have to, because it contains entity definitions
    (&foo; etc.) which a validating XML parser *has* to know before
    it can interpret the page.

    J: the line wrap is not required. All-on-one-line is fine and that’s
    what I usually do; I don’t work in 80 columns any more.

    ~bc: you are using a Javascript-style comment (‘//’) in a stylesheet.
    This is broken, but presumably without a DOCTYPE, browsers’ Quirks
    Modes are ignoring it. Also you are trying to set a positioning
    value from script without adding a unit. This is also wrong, but
    allowed by IE in Quirks Mode. You want:

    domStyle.left= cX+’px’;

    Blondinnet: this warning appears when you have selected the
    DOCTYPE from the validator’s own form. It is nothing to do
    with youe document. Select ‘(detect automatically)’ from the
    menu on the validation form and you will not get the warning.

    jrp: replace ‘&’ with ‘&’. The browser will decode that as
    a normal ampersand before submitting. This is very basic HTML
    and will even work on the 4.x browsers. And the 3.x browsers.
    And (etc.)

    Tommy: ‘encoding’ is the generic-XML way of specifying the
    character set. ‘meta-charset’ is the legacy HTML way of
    specifying it. If you have no top-bit-set characters in the
    code before the , you can get away with just using
    in XHTML. You might as well use
    encoding=”iso-8859-1″ as well – there is no reason you have
    to use UTF-8. But the best way of specifying a web page’s
    charset is to use an HTTP header in the same format as the
    hack (which just makes the browser think it has received
    an HTTP header):

    Content-Type: text/html;charset=iso-8859-1

    Unfortunately unless you have proper control over your own server you probably won’t be able to configure this. (In
    Apache, you can use the AddDefaultCharset directive.)

  52. It might be a while before the doctype table height problem is fixed. As you know, the bug is targeted for mozilla 1.2. That doesn’t seem like that far away, but it could be half a year until we see the fix. The Mozilla Roadmap ( http://www.mozilla.org/roadmap.html ) has a little change for post 1.0 milestones. The development cycle has moved into a quarter year cycle. Check out the link for more info.

  53. Greg H: “Further, XHTML documents aren’t currently checked for well-formedness by XML parsers because XHTML documents have a MIME type of ‘text/html’, which means they’re considered HTML documents by the browser, not true XML documents. Were XHTML to get its own MIME type–say, ‘text/xhtml+xml’–the browsers would be forced to parse the document and check it for well-formedness. Until this happens, XHTML documents will be checked for neither well-formedness or validity.”

    Actually, XHTML *does* have it’s own MIME type, which will eventually replace ‘text/html’; it is ‘application/xhtml+xml’. Indeed, I’ve added a Request For Enhancement to get Apache to recognise it:

    http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7795

    Perhaps when the Web Standards Project launches ‘Phase II’, they could request that iPlanet and Microsoft IIS support the new MIME type out of the box too?

  54. I am in the process of designing my website. I got it to look perfectly how I want, and I even validated the XHTML and fixed all of the errors on the page. But when I add, the XHTML Doctype, the page screws up.

    If anyone knows what could be the problem, please eMail me. taestell@hotmail.com

  55. It’s true that browsers do not attempt to validate using the reference to the DTD in the DOCTYPE. Anyone who’s loaded a local page on a laptop that’s not connected to the Internet is proof that there’s no attempt by the browser to load the external URL (it would fail otherwise.)

    Validation does occur with some XML parsers, however. If you are using either an XML schema or a DTD with a recent parser (Xerces, Xalan or the latest versions of the MS XML), the validation process does attempt to load the external URL. This can be a problem if you are trying to develop (or deploy) backend services such as XSL transforms or other manipulations of an XML data stream. Without a connection to the Internet, the validation step will fail. The solution to this problem is to copy the necessary files and refer to them locally.

    One would hope that the browsers eventually validate the XHTML source code. When (and if) they do, keeping a local copy of the DTD will be an important performance consideration; the servers at W3C will be serving up a lot of DTD and are likely to be a bottleneck.

  56. I noticed in several of these posting the phrase “well-formedness”. I not sure at that means. Is there any ALA artical on this subject?

  57. ” I noticed in several of these posting the phrase ‘well-formedness’. I not sure at that means. Is there any ALA artical on this subject?”

    XHTML is an application of XML. A well-formed XML document is simply one that nests elements properly (i.e. not overlapping like ), includes a trailing slash in empty elements, includes proper quotes around attribute values (e.g. ), doesn’t include illegal characters (e.g. Invalid element), etc.

    The level up from being well-formed is being type-valid. This means also conforming to a schema, such as a W3C DTD. A type-valid document is, by definition, also well-formed.

    You might find this article of use: http://www.alistapart.com/stories/hellxml/

  58. People who use Doctypes should be aware that many older browsers cannot understand them and insert them into the document as plain text.

    On some sites, I’ve elected not to include doctypes for this reason. These are generally the same browsers that display Javascript/Stylesheets as text as well.

    A good rule-of-thumb is that if you start all of your scripts with a

  59. Dave H: “Actually, XHTML *does* have it’s own MIME type, which will eventually replace ‘text/html’; it is ‘application/xhtml+xml’.”

    To tell you the truth, I haven’t read anything on the subject of an XHTML MIME type for several months (hence my mistake of saying “text/xhtml+xml” rather than the more appropriate “application/xhtml+xml”).

    I’m glad someone is taking the initiative to get the MIME type supported. Forcing XHTML documents to be well-formed and valid before they can be displayed will an important step for the Web. Frankly, I think it’s a necessary one if the Semantic Web project is to be successful.

  60. Which browsers have problems with DOCTYPE? I suspect they’re so old & broken, and rarely used, that it’s not worth catering for them at the expense of good coding & forward compatibility.
    If you’re not careful you’ll still be using CENTER and FONT in five years’ time…

  61. You’re right that all of the browsers that have trouble with doctypes are really old and really broken. And, for most people, they’re not even worth considering.

    The most popular browser that I know of with the issue: Mosaic.

  62. You’re right that all of the browsers that have trouble with doctypes are really old and really broken. And, for most people, they’re not even worth considering.

    The most popular browser that I know of with the issue: Mosaic.

    Really, it was more of a concern back when we wrote documents with HTML 3.2.

    I’ve noticed that ALA doesn’t bother with the

  63. People who use Doctypes should be aware that many older browsers cannot understand them and insert them into the document as plain text.

    Yes, but people who use older browsers should be tied to a drain-pipe and ritualistically hosed.

  64. “people who use older browsers should be tied to a drain-pipe and ritualistically hosed”

    Can’t quite see that becoming part of W3C guidelines, but it might make a catchy tagline for the WaSP phase II site.

  65. Actually I’m now wondering if I can get “people who don’t use DOCTYPEs should be tied to a drain-pipe and ritualistically hosed” into DaveCorp’s internal web standards… ;o)

  66. Last time I checked, Mosaic doesn’t support HTTP 1.1, only HTTP 1.0 (and yes, Mosaic still runs on current Macs). So about the only website it will still be able to read is its own homepage. Degrade gracefully for older browsers by all means, but let’s stop scaring ourselves into thinking that some browsers are still being used if they’re not. Analyse your logs, learn what the HTTP capabilities of different browsers are, and don’t worry about the shortcomings of browsers that either can’t reach your website or were never Y2K compliant.

  67. I am happy that the discussion forums are back. I have learned a good bit by reading the discussions about this article. However, it is very difficult to follow the “thread” of conversation! I would recommend a modification that would allow posters to “reply” to a particular post. Many other public forums are set up this way. I hope this will be a consideration for future improvement.

  68. Thanks for your comments. We appreciate them. Waferbaby (http://www.waferbaby.com/) has done an outstanding job developing new forum software in PHP that’s low bandwidth and XHTML/CSS compliant.

    The old forum software was threaded. One reader after another complained that the threading made it impossible to read and respond as if in general conversation. Readers begged for a flat presentation, and this is what we’ve implemented in ALA Forum Gen III.

    Of course, now that we’ve implemented it, all the people who PREFERED threading are telling us they miss it. 🙂

    We do hear you. When a reader posts on a specific topic, and his or her question gets answered five posts later, the flat presentation makes it hard to follow that aspect of the dialog.

    But what the flat presentation does provide is a more readable experience in an easier-to-use format, free of all the clicking and navigating that made using the previous forum software a chore.

    In a future upgrade, we MAY be able to offer readers the choice of flat or threaded navigation, though I can’t promise that, and we’re still working out the kinks of this new version.

    Thanks for your comments, and thanks for reading http://www.alistapart.com/ .

  69. I would have to agree with greg (previous post). The new forum look is rather hard to follow. I like the contrast of the titles to the post though.

    I was hesitant to post this, as we haven’t yet seen the new forums in their completed state, or at least that’s how it seems. Perhaps when all the older content gets ported ovah we shall be enlightened?

    Of course we will,
    – Nate

  70. This was just funny. Should/could not the new posts be posted at the top of the list?

    Also – I love the (e) – quite sexy,
    – Nate

  71. Nate wrote:

    >Should/could not the new posts be posted at the top of the list?

    There are advantages to displaying comments in the order they’re received. The chief advantage is of course that replies make sense when viewed in the order of posting, and make no sense whatsoever when they precede the comments to which they refer.

    “Newest post first” is a fine convention for weblogs, but not for conversations. mean I what know you If.

    The advantage of placing the POST A MESSAGE field at the bottom of the page is that it encourages you to read existing posts before sharing your thoughts.

  72. Does anybody know where I can get a list of the tags and properties supported by each doctype? My problem is that I use deprecated tags, but I don’t know where to find the right ones for the version I’m using. Half my pages validate to HTML 4.01 strict, and the others validate to HTML 4.01 transitional, and none validate to xhtml.

  73. i didn’t quite know what i was going to do with myself when the ala forums first went away, until one day, i didn’t notice that i wasn’t noticing they weren’t there, and that was sad.

    now – i’m noticing them again. and that makes me happy.

    thank you.

  74. Did some sniffing around, and according to this page ( http://www.opendoor.com/homedoor/homedoorbrowserlist.html ), Netscape before version 2, and IE versions 2.1 and earlier do not support HTTP 1.1. Since many servers now seem to run HTTP 1.1 only (including MacEdition’s hosting service), odds are that users of these browsers won’t be able to reach your content at all.

    So in response to the earlier posters who wish bad things upon users of older browsers — don’t worry, there’s a limit to how old the browsers you see can be. What this also means is that the small numbers of hits for these Jurassic browsers recorded at the canned statistics sites like http://www.thecounter.com/stats/2002/March/browser.php are almost certainly misleading. But we knew that from their inability to record the early months of uptake of IE6.

    Of course, we still have to deal with version 3 and 4 browsers sometimes.
    Not really about DOCTYPES, I know, but germane to the discussion. Until we can be sure that the alleged browsers that choke on DOCTYPE declarations are also compatible with HTTP1.1, I think that DOCTYPES can be included without compatibility fears.

  75. Threaded presentation has its advantages in theory – so does hypertext storytelling – but they seem far outweighed by the simplicity of a good old linear discussion.

    I welcome the change – less clicking, more cross-pollenation of ideas, easier access to the content, less chance of skipping over important posts and no more hunting through inconsistent titling.

  76. Just so ya know, even “modern” browsers that claim to support HTTP 1.1 don’t do so very well.

    For example, even the current version of IE 6 doesn’t support chunking.

    It’s kinda ironic that “1.1” browsers aren’t, in that a compelling reason that HTTP 1.1 was made at all was because there was a glut of “1.0” browsers that weren’t.

    Herein lies a flaw in recommendations masquerading as standards. Without normative test suites, it’s all too easy for a browser to support “foo”, since no one goes to the trouble to exhaustively test the support.

    Instead, we poor developers are left to frequently stub our toes on inconsistencies and downright bugs, even in “standards compliant” browsers.

    Sometimes it shakes my faith in the eventual goal of the semantic web.

    To steal a phrase, No. wonder. the. kids. love. flash.

  77. The commenting system at Palm Infocenter might offer a simple compromise on the flat vs. threaded issue. Instead of full-out threading, they allow replies to be grouped under the main initial post that started that particular topic, and provide two modes of viewing: nested and flat.

    In “nested mode” you can see the initial posts of each topic, with links to replies. And in “flat mode” all topics are shown fully expanded.

    It’s not as easy to pick out the latest posts, but it’s much easier to follow discussions, and perhaps more importantly, the discussions you’re interested in.

    Article in “nested mode”:
    http://www.palminfocenter.com/view_Story.asp?ID=3307&MODE=NEST

    Same article in “flat mode”:
    http://www.palminfocenter.com/view_Story.asp?ID=3307&MODE=FLAT

    – Porter

  78. Jeremy makes a good point ( http://www.alistapart.com/stories/doctype/discuss/#ala-173 ), but it’s not the issue here. The concern noted above by an anonymous poster (http://www.alistapart.com/stories/doctype/discuss/#ala-149) that “People who use Doctypes should be aware that many older browsers cannot understand them and insert them into the document as plain text”, is the issue. Until someone actually can tell me which those very old browsers are, I hold to my suspicion that it is a non-issue. Never mind that some features of HTTP1.1 aren’t supported even in newer browsers, the point is that very old browsers (pre-version-2) can’t even see the content because they don’t support HTTP1.1 *at all*. As an example, download Netscape 1 or Mosaic 0.9 from evolt’s archive and point it at http://www.macedition.com/. Last time I tried this, I got a message that my browser didn’t support HTTP1.1. In theory HTTP1.1 responses are meant to be backwards-compatible with HTTP1.0-only clients (http://www.openresources.com/documents/open-sources/node105.html) but apparently it doesn’t always work like that for ancient browsers.

    Anyway, this networking protocol stuff is way beyond my realm of competency, so I’ll shut up now.

  79. What’s the difference between:

    and

    Have never seen the answer to that. Which should I use for pages in English?

  80. >>> What’s the difference between charset=ISO-8859-1 and charset=utf-8?<<< All web pages are transmitted not as characters but as sequences of bytes. The encoding of the page says how the bytes are converted in to characters. ISO-8859-1 is an old-style 8-bit encoding. It uses the byte value 0x41 to represent U+0041 (capital A), and 0xC1 to represent U+00C1 (capital A acute, if memory serves). (The U+xxxx codes are Unicode's character codes.) This is simple, but limited to the repertoire of ISO-8859-1. UTF-8 also uses the value 0x41 to represent U+0041. But the Unicode character U+00C1 is represented by two bytes: 0xC0 0xC1. UTF-8 can also encode other characters, like U+2014 (em dash), which is represented by the sequence 0xE2 0x80 0x94. In fact UTF-8 can represent any Unicode character, at the expense of being a little more complex to decode than ISO 8859-1. That said, for pages in English that do not use typographic punctiation and avoid words like café and Ã¥ngström, there is actually no difference between the UTF-8 and the ISO-8859-1 byte sequences! Since UTF-8 is the default for XML it is probably simpler if you plump for that. —Damian

  81. A “forum about the forum” will be created at ALA shortly. That will be the place to post comments about the new forum.

    I appreciate the enthusiasm and helpfulness of the many comments about the forum, but they really are off-topic on this page. I ask you to wait and save such comments for the forthcoming “forum about the forum.” (Try saying that with a mouthful of peanut butter.)

    Thanks for understanding.

  82. Those of us that still have to work in tables for layout, keep in mind centering a table in IE 6 and using the links to the DTD can cause the content to center in the table. http://www.evolt.org/article/Does_IE_6_Center_Your_Table_Content/17/15341/ provides an overview. The best solution is to set the alignment in the tables in the CSS.

    Thanks for the great article. I had just convinced folks I work for to move to the proper DTD and link a few weeks ago. This article helped support that it was the right move.

  83. Just to tell you, I informed Microsoft about the IE6 going into quirks mode with an XML declaration in about June of 2001. Methinks IE6 might have been a tiny bit rushed to fit the Windows XP schedule.

    Actually, I’m quite glad they didn’t fix it – means I can easily stop IE6 using the horrid and massivly buggy standards mode (see http://tom.me.uk/2002/2/ie6css.html).

  84. Good article and a fine resource of DTDs Jeffrey – thanks (PS i’m enjoying your Book).

    What about Namespace’s though? I have to admit I don’t really understand the concept. I have included them in all of my recent XHTML 1.0 pages but I’m not sure if I use the correct one or even why. Any comments?

    I have to agree that the flat discussion group is very hard to follow (I bet Jacob N would have a few things to say about it!). It’s so hard to find a response to any messages one sends. I have found the only way is to enter a search string in “Find on this page” in IE. I can at least then find my own post.

    Anyway all the best.

    Simon

  85. xhtml is an xml application. In xml, you can declare your own tags. Let’s say, you create some xml language that needs a

    Uh-oh! Namespace conflict! How does the parser know if the

  86. Im just designing a site for a customer. I decided to go with XHTML and CSS.
    There seems to be a problem with the Doctype for XML and CSS File linking:

    Check out http://www.nsag.ch/demo/template4b.html – the page renders fine in IE5.5, Opera6 and even in a simplified mode on NS4.7 PC. However, on Mozilla, it looks like the stylesheet was not imported. I used

    for the stylesheets and
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    for the Doctype.

    NOW THE FUNY THING COMES:

    When I either remove the Doctype ( http://www.nsag.ch/demo/template4b_nodtype.html ) or when I just add the CSS to the file instead of linking to a external css file (www.nsag.ch/demo/template4b_unlinked.html) it WORKS FINE!!?

    WHAT THE HECK… ?? 😉

    Any ideas?

    Till

    P.S. The Page validates – except for three tags I need for NS4.7

  87. Im just designing a site for a customer. I decided to go with XHTML and CSS.
    There seems to be a problem with the Doctype for XML and CSS File linking:

    Check out http://www.nsag.ch/demo/template4b.html – the page renders fine in IE5.5, Opera6 and even in a simplified mode on NS4.7 PC. However, on Mozilla, it looks like the stylesheet was not imported. I used

    for the stylesheets and
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    for the Doctype.

    NOW THE FUNY THING COMES:

    When I either remove the Doctype ( http://www.nsag.ch/demo/template4b_nodtype.html ) or when I just add the CSS to the file instead of linking to a external css file (www.nsag.ch/demo/template4b_unlinked.html) it WORKS FINE!!?

    WHAT THE HECK… ?? 😉

    Any ideas?

    Till

    P.S. The Page validates – except for three tags I need for NS4.7

  88. I encountered this, too (with an xhtml1.1 doctype and @import url();). This must be a bug of moz .9.9 (never happened to me before) in some way or another – exactly the same page does load with style from my harddisk but does not from the net. There indeed seems to be a problem with finding the file in standards mode. Did moz display the file with dtd correctly from your harddisk?

    Alas, the bugzilla interface is too unusable for me, so I don’t know what exactly it is.

  89. No, I didn’t try to load from the Hard-Drive .

    But I found something else: When I hit CTRL-I (as described in one of the earlier posts) it actually shows me that the rendering mode is standards compliant.

  90. Well, it is not the first time I visit the discuss-list, but now I get a strange rendering on my screen.
    The lenght box(?) from article n3 date 11/4/02 “Whoops” by Mullenberg goes to the line on the right side of the list.
    The one from article “Centering & table IE6 by Vanderwal goes halfway.
    Don’t remenber if there was an external border to the right sight of the list.
    Seems strange, got no explanation therefor.
    Apologize for my writing in english wich is far then good.
    Ho, forgot to say, I am on IE6, yes it is true!!

  91. I have a page that contains several split up images and I’m also using rowspan. When this page is viewed in Netscape 6.x, I get a white horizontal line across the page right below my rowspan. I only get this problem when using a valid doctype, if I don’t use a doctype at all the problem goes away. I’m trying to get my company to start coding to w3 standards which this code does validate too. To make the code totally valid I need a doctype but that causes a problem, and once again it brings me back to the point why bother writing valid code if all you end up with is more problems.

  92. Michael

    You made my day! 🙂
    The page is running with an external ISP, I just tested the page on our own Servers and it’s working fine there.
    So, I “only” need to convince Switzerland’s biggest ISP to change their MIME types :).
    (On the other hand it’s good to know, that our servers are well configured :))

    Thanks.

    Till

  93. After changing my code to XHTML transitional, it ignored my scrollbar style. Does XHTML not support the styles for the scrollbar?

  94. From IE6 on, the “main” scrollbar is not an attribute of body anymore, but of html. Changing the style sheet accordingly to html,body {scrollbar-properties:;} will help.

  95. If you are using IE6 and a doctype , don’t forget that the scrollbar’s style declaration must now be include in the html element and no more in the body element as before.

  96. Found this doctype on a Norwegian designer’s page:< !DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> Looks incomplete, but where is it from, and why would anyone use it?

  97. No, the incomplete Doctype rule is only ONE Solution. Better is:

    — begin quote —
    Setting images to be blocks
    The first choice, and one that will work for most graphically-intense designs, is to convert the image from being an inline element to a block-level element. Do that, and it no longer generates a line box, and so the problem goes away– assuming that the image is the only thing that occupies that table cell. In the simplest case, we might add a style like this:

    td img {display: block;}

    — end quote —

    Did you read the text ? 😉

    Till

  98. Latest DOCTYPE hassle – HomeSite 5 doesn’t automatically switch into XHTML mode if the page has an XML declaration at the top. And so far I’ve not managed to find an option to make XHTML the default, which is a pain as I rarely use anything else nowadays. All very disappointing.

    As for problems with spacing in Netscape 6 – when building simple things like navigation bars consisting of a row of images I find setting the font-size for that div/p/td to 1px does the trick without any harmful side-effects.

  99. Compare a flat forum like ArsTechnica to a threaded/nested forum like SlashDot. While a threaded discussion helps you keep track of threads, it makes it much easier for individual threads to be completely sidetracked from the original topic.

  100. Matt, have you tried changing HomeSite’s default “color coding” settings? Setting “xhtml 1.0 strict” as default and adding “.html” to the list of file extensions together with the options in “Markup Languages” should help.

  101. Craig, this is an interesting point with IE6. Microsoft created IE6 so that it could be backwards compatible and wouldn’t destroy web sites that were developed with non-compliant code. In order to set IE6 to standards mode, you simply need to declare the appropriate DTD (document type definition) at the beginning of your pages and be sure that your pages validate with the DTD you are using. Simply put, if your pages don’t specifiy a DTD, IE will render them according the the “quirks” mode.

    Here is the link with Microsoft’s explantion: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie60/html/cssenhancements.asp

  102. Two remarks:

    1. Many people have expressed bafflement as to why the W3C doesn’t have a list of what DOCTYPEs you should use to invoke standards mode. The reason is that this notion of sniffing the DOCTYPE and going into standards mode or quirks mode has nothing to do with the W3C.

    DOCTYPE sniffing was an act of desperation chosen by browser manufacturers a few years ago to provide some way of grafting standards-compliant rendering onto browsers that had to remain compliant with outrageously noncompliant tag-soup markup on existing pages. The seemingly arbitrary lists of quirk-inducing DOCTYPEs simply come from various browser developers’ observations of what DOCTYPEs tend to appear on these offending tag-soup pages. The origin of the sniffing details is historical, not logical, and you’ll just frustrate yourself if you try to look for some underlying logic to it.

    The W3C-endorsed intent of DOCTYPEs is to specify what syntax the page uses, no more, no less. User agents were never supposed to make page-rendering decisions based on them. Thus many DOCTYPEs that have inequivalent results in modern browsers (because of the presence or absence of a URL, the exact nature of the URL, etc.) theoretically mean the same thing.

    Indeed, you will find many venerable SGML and HTML experts who insist to this day that DOCTYPE sniffing was a terrible idea that never should have been implemented. Personally I think that, given the economic realities of browser production a few years ago, the choice was between something like this kludge, or *no* possibility of standards-compliant rendering at all. Given that choice, I’ll take the kludge.

    2. Some people have yearned for a browser that actually validates pages and rejects bad ones, as an educational and authorial aid. iCab for the Macintosh ( http://www.icab.de/ ) doesn’t reject ill-formed pages, but it does frown upon them with its “smiley face.” Unfortunately, its utility is reduced today since the smiley was never extended to cover XHTML; also, its CSS rendering is annoyingly nonstandard.

    There are other tools you can use for this purpose besides online validators. My favorite is HTML Tidy ( http://www.w3.org/People/Raggett/tidy/ ) which not only finds mistakes but can actually fix them in many cases.

  103. Oh, and speaking of HTML Tidy and DOCTYPEs, I suppose I should mention that according to the SourceForge buglog, recent open-source versions seem to have a lot of trouble generating the right DOCTYPE automatically. I’m still using Terry Teague’s BBTidy plug-in based on Dave Raggett’s 4 Aug 2000 code, so I’m not seeing that…

  104. About the URL’s issue – I have done something a little different – I have a set of pages with a status-bar at the top with relevant info about the page that changes with each page …

    On my Bryce 5 Art page, I wanted links to the Corel website to the Bryce product page, and to a service to test the software online … however with links such as

    http://www3.corel.com/cgi-bin/gx.cgi/AppLogic+FTContentServer?pagename=Corel/Product/Details&id=CC1M72VRBAC

    I couldn’t get my page to validate.

    I then decided to write a (simple) javascript for those links that use symbols that cause te validator to have a hernia:

    function brycelnk1() { window.open(“http://www3.corel.com/cgi-bin/gx.cgi/AppLogic+FTContentServer?pagename=Corel/Product/Details&id=CC1M72VRBAC”) }

    and then call the function from the link like so:

    Bryce 5 – great tool for beginner 3D artists

    It’s an ugly hack (but so is the Box Model Hack by our mate Tantek Zelik so I think I’m in good compnay) – and it works for the job I asked it to do – which is cause the page to validate.

    Hope this helps y’all … ( and any feedback on my little teeny corner of da web would be appreciated 😉 )

  105. According to the official XHTML spec, you should insert this line at the start of all your documents, right?:

    < ?xml version="1.0" encoding="ISO-8859-1"?>

    Well, guess which other popular web language uses < ? ?> in its syntax. Yup, PHP.

    If you try to put the above xml version line into a document with a .php extension, the server will treat that line as PHP and the result will be that you won’t get any output at all.

    I’m not sure if this is an issue for the PHP Group, Apache or W3C to fix, but it’s a pretty blatant clash, I think. Thankfully, the XML version line is optional, but this issue really should be addressed sooner rather than later.

  106. You should be able to work around this by doing something like:

    echo ‘< ?xml version="1.0" encoding="ISO-8859-1"?> ‘;

    within your PHP code. Instead of just placing it at the top of the file.

  107. If you change the & in your URL to & then the validation problem should go away and the link will still work.

    Some CGI software will allow you to use ; instead of &, which gets rid of the problem completely.

  108. Yes, I am forced to change all &’s to &’s to get my page to validate – along with other characters that may cause the validator to slip up.

    Very informative article and a wonderful discussion that clarified many of the points I was confused about. Thanks!

  109. I congratulate you on this article, as it gives and points out excellent information that everyone (and myself, of course) will sure be glad to have in one place.

    The only issue I thought could have been added, was including http://www.evolt.org in your mention of developer oriented sites.

    Another great job, Mr. Zeldman!

  110. Zacchix mused: “According to the official XHTML spec, you should insert this line at the start of all your documents, right?: ‘< ?xml version="1.0" encoding="ISO-8859-1"?>‘ Well, guess which other popular web language uses < ? ?> in its syntax. Yup, PHP. ”

    Actually, it is neither a bug in PHP nor in Apache, nor any W3C standard. You just have your PHP configured improperly. PHP has a few configuration directives which lets you specify which tags to parse. Change the php.ini configuration variable “short_open_tag” to 0 (or false). You can do this in your php.ini to globally require the long tag format < ?php ?> or in your .htaccess file on a per-directory level.

    See http://www.php.net/manual/en/configuration.php for other configuration directives.

    The bottom line? Always use < ?php ... ?> syntax when writing PHP scripts. You ensure that your scripts will work for others who have explicitly turned off their short tags.

  111. Your supposedly correct doctype tags screwed up my site big time in netscape 6. It caused all table cells on the page to have a height of 1em. It also caused hex color values that did not have a hash prefix to stop resolving correctly. If your article is indeed correct about doctypes that means Netscape 6 has a MAJOR bug in”¦ Which would not surprise me at all”¦”¦.. >:-(

  112. You don’t need to include the xml header anyway.

    Using to specify the character encoding is valid xhtml as well. And since IE doesn’t activate strict mode when using the xml header + file suffix “.html”, I believe this is the better solution for now (which of course is no reason not to use the long < ?php ?> tag).

  113. > Your supposedly correct doctype tags screwed up my site big time in netscape 6. It caused all table cells on the page to have a height of 1em. It also caused hex color values that did not have a hash prefix to stop resolving correctly.

    When I read the part of your post quoted above initial my reaction was “What the hell did you expect”. Then I thought more and wondered why you had hex colour values without the hash. As the construct has been around in this form since at least 1995 I wonder how you have come to build web pages without the hash? Do you use an editor that leaves out the hash or are you using something like Visual Wordpad? My question is – why haven’t you used the form that is a standard?

  114. I’m very happy to see the Forums back up & running. They were sorely missed.

    Once again, great article Zeldman.

    Till,
    Thanx for the Link on the NN6 Image spacing issue. I was able to fix a very similar problem i was having with a Rollout menu.

    Thanx,

    Normando

  115. Craig –

    > How can I tell when IE6/Win is in standards or in quirks mode?

    This is available to scripts through the ‘document.compatMode’ property. If you want to find out how it’s set for the current page, type:

    javascript:alert(document.compatMode);

    into the location bar. You’ll get ‘BackCompat’ for Quirks Mode and ‘CSS1Compat’ for Standards Mode.

  116. Usefull and well writting article! Mr. Zeldman brand… the usual quality.
    Meanwhile, i am getting a strange page rendering on my site. I am porting it for XHTML transiotional (thanks to Alistapart!!!) and CSS. Getting validation from W3C DTD with no errors. But… IE 6 (and no other that i know — did try IE 5/ Mac & Win and Mozilla 1.0 release) center my all text!!!!!!!!!!
    I do the revision of my code in BBEDIT and don´t seem able to figure out the error … am i missing something here? Anyone can help ?

    Best regards to all,
    Bruno Monteiro

    http://bist.ist.utl.pt

  117. > When I read the part of your post quoted above initial my reaction was “What the hell did you expect”.

    The problem with the hash colors I did expect… but the problem with the

    cells all defaulting to 1em height I did not. Since tables cannot be displayed properly in netscape 6.2 with this articles doctypes, I can’t use them. Am I the only one who has this problem?!?
  118. IE6 mindlessly centers text that should be left-aligned by default.

    The fix – in your style sheet:

    body, p, td, li, ol, etc {
    text-align: left;
    }

  119. Note: “etc” should not be taken literally. (Don’t include “etc” as a CSS selector.) All “etc” means is, whatever HTML element or DIV you’ve got going on your page, you need to include a CSS declaration of text-align: left for that element (unless you’re deliberately centering or right-aligning the element).

    By default all elements should be left-aligned, and they have been in all browsers until now, but IE6 screws this up. Fortunately, it’s easy to add these rules to your style sheet.

  120. I’m still very confused by correct doc types and their influence on DHTML javascripts. Our little team here is using a popup menu thing on our pages and it works fine with an incomplete doctype but if we use the ones suggested in the article (which I would like to do) it turns out badly. I guess the kicker is that it is from the menu maker tool in Fireworks 4- maybe MX will address it :-). Can anyone talk a little more about Doctypes and Javascripts?

  121. We are generating our site from complete XML files using the Sablotron XSL transforming engine. I need to output a DOCTYPE with the html, but when I include it, I get this error message:

    Warning: Sablotron error on line 9: XML parser error 4: not well-formed (invalid token)

    It’s couphing on the ‘< !' characters, I think. My hunch is that there's a way to have the XSL automatically generate the DOCTYPE for you, based on the tag settings …. anyone dealt with this before?

  122. I’m developing a site where I’m using an iframe that has it’s scrolling property to auto. When I have the proper doctype specified so that IE6 is in standards mode, my content will have a horizontal scroller regardless of it’s width. Other browsers I tried (Opera, NN6, IE 5 on Mac) all display it properly. My only solution was to remove the doctype, then the table I have the content in defaults it’s size to the size of the iframe, minus the scroller width.

    Anyone know the deal?

  123. > IE6 triggers quirks mode if there is an XML declaration present.

    I’m glad that IE does this. Since it doesn’t recognise css declarations in the form:
    body>class {stuff}

    my css layouts still work. If they enforced the standard box-model without recognising the above declarations, layouts for IE 5 and 6 would be incompatible.

  124. “Yes, lang=”en” says that the document is in English. If you have some inline French you can stick it in le blah. ”

    Does that have to occur in every French word in the text? There are loads of them in these pages. or it can be added to the doctype syntax?

    thanks and great site

  125. Hi,

    I’ve a tiny personal site where I use Nedstat free counters to keep my own basic statistics. The thing is that now I have decided to go XHTML (just for the fun of it). I’ve made a trial at http://www.gusgsm.com/html/petete.html and it validates (W3C) all right. However I cannot include the counter code because validators say I cannot “include an inline element inside a block elkement” (ie: an image [the counter logo] inside a link [the link to the provider site]).

    I think I cannot put their code in an external JavaScript file as it is made to “count” accesses to another file. Am I wrong? I’ve tried and, for some reason it does not work…

    This trouble would leave without a service I wouldn’t like to loose. Any idea? How would you do it?

    Thanks in advance.

    PS. Terrific place this is. Though I find the threads (in looong galleys) quite difficult to browse.

  126. What are the disadvantages of omitting the URI in the DOCTYPE? The above-referenced O’Reilly article advocated using an HTML 4.01 Transitional doctype without a URI in order to get Mac IE 5 to go into “quirky” mode. Apparently Zeldman is not suggesting that approach, though he didn’t address it in the article.

    I write valid HTML 4.01; however, at work, our 6000+ page website has some old, nasty HTML, and certainly some deprecated tags, unfortunately. It’s impossible to go through the entire site and get rid of all of them.

    Does anyone know specifically what quirky mode does? Do other browsers differentiate between doctypes with or without the URIs?

  127. Ok!
    So, after having played with those DOCTYPE thingy, I experienced one MAJOR and STRANGE problem with the dom of Mozilla 0.9+.
    I wrote validating XHTML strict content, specified a doctype and layouted it with CSS. Everything goes fine. And then I started adding DHTML in it, using the dom… adding node, removing nodes? Works perfectly! But…
    Mozilla 0.9+ simply REFUSE to accept changes on the position of my elements. I was doing some cool and sexy DHTML div’s sliding but hey, Mozilla doesn’t want to ear about it. Nothing move at all!
    If I kick the doctype, presto, everything suddendly works and move exactly as it should! (some css fall apart in the process but…).

    Is there anyone here that can gieve me a hint or an explanation on that matter? I’ve read at least 10 articles on the DOCTYPE subject, adviced by people, but none gave me at least a shadow of explanation on that particular matter! What’s happening with mozilla, hu?
    Thanks!

  128. does anyone know how to use

  129. Okay, I’m a bad developer, but I was playing fast and loose with < !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">.

    I install Netscape 7.0 for PC this morning just in time for some cross-browser checking, and lo and behold, the doctype is causing my stylesheets to be utterly disregarded!

    I collapse upon the studio floor, moaning “why, why…?”

  130. Interesting results if you view this page (the one you’re looking at now) in Netscape 4.x

    Standards!

    Anyway, I was wondering if it’s possible to get the w3c to consider adding :hover as a modifier to all tags in the style sheet (think img:hover).

    Also, I’d love to be able to switch the hover color for the a tag down in the html document. Too bad I can’t assign separate style sheets to different portions of the page without using frames.

    Thanks for a gerat article.

  131. Thanks very much for your article and the useful links. w3.org is a great piece of work but it makes my head spin – I know the information is in there somewhere but it’s difficult to find under all the geekiness 😉

    I am now more confident about putting DOCTYPE into practise and also now realize an older site I made will require a custom DTD to accommodate non-standard attributes such as the LEFTMARGIN attribute on the BODY element.

    I got details about that here:
    http://www.htmlhelp.com/tools/validator/customdtd.html

    thanks again

  132. OK does anyone know how to do target=”_blank” in xhtml1.1 ?
    I downloaded the dtd from the w3c and have searched high and low for how to modify the module (if possible) but no luck…

    Thanks… just need a target 🙂

    JimS.

  133. What do you folks do with 3rd party html from things like banner exchanges and the like?

    They typically use CENTER tags and lots of deprecated stuff.
    Ok I can use transitional doctypes but how can you use the Strict
    doctypes without breaking their rules (don’t change our html)?

  134. Suzanne, you should actually put the URL part on the second line!
    I always used to put them on a single line until I changed the URL
    as per this article, and then IE5.5 stopped rendering my page!
    IE5.5 wanted to download the page instead! Talking of bugs.
    The solution was to ensure that the URL part of the W3C dtd is placed
    on the second line
    “http:/…… .dtd”>

    I am using html 4.01 transitional.

  135. This seems to be a reoccuring theme, but I’m having issues with JS and Doctypes. I’m trying to use a wonderful script from youngpup for scrolling text. It works fine on a page w/o a DocType. As soon as I put a DocType on the page it breaks in IE 5 on my Mac. Works on everything else I’ve tried with or w/o the DocType. I’ve seen some of the posts talking about changes to the DOM when browsers go into strict mode, I’ve also seen posts that deal with the JS writing invalid CSS. Can anyone help with this? I’d love to find some information on what changes in the DOM when in strict mode.

    Thanks

  136. BTW, I know I’m using tables in this page. Client needs this site to look reasonably close in Netscape 4.x, no matter how much I’ve tried to convice them otherwise. But the code validates. The JS error I am getting is “invalid procedure call or argument”

  137. Strange and unusual:

    If I use the XML declaration above the DOCTYPE dec, like so:

    < ?xml version="1.0" encoding="iso-8859-1"?>
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    I get this error from an apache (1.3.26) web server:

    Parse error: parse error, unexpected T_STRING in /some_path_here/file.php on line 1

    However it works fine on an IIS 5 web server.

    Now this is where it gets even more strange. If I use this code instead:

    < ?php echo "“; ?>
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    It works just fine on the apache and IIS!!!

    Anyone know what may be going on here?

  138. I spent the weekend scratching my head wondering why my carefully drawn tables wouldn’t display properly. I was drawing the tables in an old version of VisualPage and nothing I did seemed to clear up the problem.

    After a good night’s sleep, I decided to try again in a text only HTML editor and voila, my tables came out perfect……but I had no clue what made the difference.

    After reading your article, I checked the doctype and sure enough (and not surprisingly) VisualPage had an obsolete doctype while the text editor (for which I stroked my plastic on Sunday 🙂 had one of the doctypes mentioned in your article.

    Not all of us need in depth information

    Thanks for the information,
    Margaret

  139. Hey guys – nice article, I found it informative and it gave me enough information to know what I had been doing wrong in the past.

    I’ve got a problem using the transitional doc type, though … I used to use mytext and the likes, but a width on a span under transitional doesn’t seem to work – P and DIV still do, just not SPAN.

    Is this known? What is the purpose behind this behavior? What is the solution?

  140. The HTML4.01 DOCTYPEs are quick and simple to find, they live in the DTD section of the spec, which is quickly reachable from the Conformance chapter (a whole two clicks!).

    The XHTML1.0 DOCTYPEs are also easy to find, in the Document Conformance section.

    Oh, and an XHTML document without an XML Declaration is invalid. Read the “Document Conformance” section of XHTML 1.0 and the “Prolog and Document Type Declaration” section of XML 1.0 (Second Edition)
    Links:
    http://www.w3.org/TR/xhtml1/#normative
    http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd

    The list of TRs is at http://w3.org/TR/, which is a nice big link named “Technical Reports” on the main page.

    Then again, maybe I’m just one of those geeks that makes the rest of you look like first-day AOlers, back in 1997.

  141. Great article. Just recently I was having problems with my cascading menu and by sheer chance found out the cause was an incomplete DOCTYPE statement…did I feel a charlie LOL.
    Now I know the reason fully thanks to the explanation in this article 😉

  142. Hello, the article was great, I finally know a little more about these obscure tags that I have always wondered about… Justin Simoni’s comment is at least as sharp as he and his cool scripting is! He is right. Doesn’t anyone think that they would need a ton of Gb of bandwidth to accomodate that kind of network traffic?

    Anyway, the main reason why I am posting here is because I am still majorly confused about something:
    My site works great in all major browsers (at least from my computer) WITHOUTH the doc type tag and when I add that it doesn’t work in Mozilla/Netscape anymore.
    I tested my site in IE5/6, Opera 5/6, Netscape4/6 and it worked in all of them without the tag but when I add the tag my interface gets screwed up and of course I loose the scrollbar related features… Is there ANY WAY to avoid this? Is there a doctype that will allow my site to display properly in all browsers and keep the features on ie?

    I have notice all these comments are very old so if somebody reads mine and finds it in him/her to suggest something to me please let me know via email at webmaster@featherfactory.org

  143. Not lazy, far from it having spent aaaagggggeeees trying to work out this doc type thing, just an amateur. Most of my docs are checking out as 3.2 so, what is the http thing that I put underneath the doc type? Can’t find it anywhere, if it exists.

    Bit bothered by whether it is really necessary or not – my quote of the week from http://www.wordspy.com was, “There is nothing so useless as doing something efficiently that didn’t need to be done”.

    I have got Tidy to tell me the doctype – if I do need http for 3.2, please someone tell me where to find it? – nearing end of tether – though this article provided some welcome perspective 🙂

  144. If an earlier post appears from me, apologies, it seems to have disappeared into the ether. The gist … if Tidy tells me my doc is 3.2, do I need the http stuff after the DOC TYPE bit? If so, please, what is it? (Not answered by following link in posts above).

    Thanks, good article,

    Frazzled Amateur, at end of tether trying to get it right 🙂

  145. This snippet from the article is now outdated:
    “You can search for DOCTYPEs all day at w3.org without finding one page that lists them all. And when you do hunt down a DOCTYPE (generally in relation to a particular Recommendation or Working Draft), it’s often one that won’t work on your site.”

    On the W3C site, there finally *is* a list of doctypes one can use:
    http://www.w3.org/QA/2002/04/Web-Quality

  146. I have no errors when I validated my page as strict XHTML, but still it says that my page is not valid. I have no idea what could be wrong with my page! Any suggestions?

  147. As iam doing project regarding HTTP protocol.
    I want to know the difference between HTTP/1.0 and HTTP/1.1 version

  148. This is the DTD I have been using:

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

    It validates using the w3C validator, but seems to throw IE6 into quirks mode unless I remove the “” line, even though it is not the first line.

  149. I usualy validate my pages with W3C but i am getting this doc type error and i cannot get rid of it. I have 4 errors on my page..all attribute errors. im thinking if i clear up the doc type issue the others will be resolved. Any help would be VERY appreciated.
    http://www.vectorbytez.com
    thanks

  150. — or, Bad Developer! No Biscuit!

    This article is a very clear explanation of a topic I wasn’t finding very clear. Thank you.

    Looking through back issues of ALA, I read

    http://alistapart.com/stories/msn/
    Hakon Wium Lie, “MSN, Opera, and Web Standards”

    Which, among other points, rightly castigated MSN for booting Opera users on the grounds of noncompliance, while the MSN site code was itself noncompliant. For a start, most of the MSN pages Lie looked at had no DOCTYPE declaration.

    “Interesting”, says I, “I wonder if things have changed since Lie wrote the article in 1991.”

    I went to support.microsoft.com, http://www.microsoft.com, http://www.msn.com and found no DOCTYPE declarations at all, as far as the eye could see (or randomly surf around, anyway). I went to Lie’s own home page, http://people.opera.com/howcome/ and found, whoops!, no DOCTYPE there, either. tut, tut. Not to mention that the a-ring

  151. I found your site when looking for help in finding a Doc Type that will work with my site. I have tried several including the ones on your page, but everything I try messes up my sub menu on many browsers.

    The page validates if I use one. I have been trying the transitional 4.01’s mostly. Any help is appreciated.

    Site: http://zionnational-park.com

  152. This article is fairly useful in giving a basic overview of what to do about choosing the right DTD for the job, but my problem doesn’t seem to be addressed… I’ve got “< ?xml version="1.0" encoding="iso-8859-1"?>
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">” as the first two lines in all of my pages and yet… no matter what I seem to do… IE6 ALWAYS seems to display them as the collapsible XML source!! What am I doing wrong?? My code validates–IE is just being retarded!

    Any ideas?

  153. So the answer was to move the following three lines together to the top of my pages:

    < ?xml version="1.0" encoding="iso-8859-1"?>
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  154. I was trying to validate a page and was told by the validator that I must use a DOCTYPE. I tried the < !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> but it makes my site ignore the CSS in Mozilla and Netscape 7. Is there any simple reason for this without seeing the code?

  155. After reading through all the pages of the thread which I didn’t realise were there I see that other have the same issue… I still can’t getting it to look right in Moz/NS7 with the DOCTYPE ??? Any ideas please tell me! Email *** miles at streetdaddy dot com ***

  156. I had great fun to read your articles since it tells the exacts mistakes i’ve done before to find your page : I did Validate w3c home page with w3c html validator, considering good results i copyed this XML doctype on my pages…
    I realise now, how people can make the same stupid thinks and how it can be a “kind of false empiric logic”. Thanks !

  157. So here’s the thing. My code validates to HTML 4.01 with the W3C online validator. IE6 renders it perfectly using the strict or transitional DTD’s (standards mode) however Netscape7 loses the pages external stylesheet when in standards mode, so I’ve ended up using a quirks mode 4.01 DTD. Anyone had this problem?

    ta

  158. Instead of externally linking to your css file, call it as an SSI – sure, it’s a workaround, and depends on you running some flavour of server side scripting, so not ideal but will work.

  159. What are the implications for intranet developers?

    Standards are great and much needed. But back to the question of backstage DOCTYPE functionality: does my IIS box cache a copy of the W3 definitions? What if our Cisco box or firewall punts? Does my intranet go down in flames with it? Or on a larger scale, could a rabid pack of mentally unstable geeks hit W3.org with Denial of Services Attacks and take out the whole shooting match? With those risks, I’m better off with no DOCTYPE declaration at all and voluminous

    and tags.

Got something to say?

We have turned off comments, but you can see what folks had to say before we did so.

More from ALA