You have to ask IE to be standards compliant

For the most part, I don't worry about standards compliance that much. IE and the rest of the world's browsers mostly render stuff the same way. None of them get it totally right. I learned today, however, that you have to ask IE to play nice and render stuff correctly.

I found a link to this article which says you have to use a particular doctype declaration to get it to render like everything else out there. Look carefully... the difference comes between this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

and this:

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

Without the second part, you get the goofy rendering with CSS padding. Lame!

Whatever IE becomes in Longhorn, it better be special, because things like this annoy me.

6 Comments

  • The point was that it doesn't follow standards by default.

  • I see, but I think that when you give a browser something that is not a standard HTML all gloves are off and it's free to do whatever it wants. Just look at Mozilla, if you argue using something that does not comply with the standards, the developers won't even talk to you :) The real problem would be if IE would not follow standards when you gave it standard HTML…

  • Sorry, Jerry, but it does validate on the W3C validator, which is precisely the reason I would've never thought anything of it previously (it's the default generated by VS, so it's in every page).

  • It shouldn't do standards by default. If you don't give a proper DTD, how should it know what standard to render as?



    Old pages then render using the quirks they expect, and new standards-compliant pages (which must have a proper DTD) will get rendered appropriately (mostly... heh).



    All browsers do this to some extent, even Mozilla.

  • That doesn't make a bit of sense. &quot;Unless I specifically tell you, don't render valid HTML and CSS. Render flowers or cats or toasters or something!&quot; In this case, it's, &quot;Render something we didn't get right the first time, instead of a standard, any standard from the past six years.&quot;

  • The problem was that at the time, the W3C was still coming up with the standards. MS wanted to release IE5, so they guessed on some of the standards. They got some right, and some wrong - in particular to the way margins and padding worked. So, MS came up with the whole quirks and standards modes. The reason that quirks mode is the default is that many sites use the MS way of padding and margins - after all, it took forever for the W3C to decide, and even now, XHTML is hardly realistic - why, for instance, can't tables have a height?

Comments have been disabled for this content.