Fun with Quirks Mode
OK, I'm by no means a complete expert on the subject, but I think I know enough to be able to shed some light on Adlai Maschiach's XHTML in VS2005 post.
He describes some trouble he had porting an ASP.NET 1.1 application to
ASP.NET 2.0 and tables with 100% height not rendering as
expected. He recommends switching the doctype to HTML 4.0
transitional and removing the link to the dtd from the doctype
declaration. Now this will work, but it is important to
understand what's happening in the background.
IE and Firefox (and perhaps other browsers) have at least two
different rendering modes. Standards Mode and Quirks Mode. In Standards
mode, the browsers render the html in their most standards-compliant
manner and generally behave like the W3C (World Wide Web Consortium -
the people who develop the standards for HTML, CSS etc) would want them
to. In Quirks mode, IE and Firefox throw the standards out the window
for the most part, and emulate little quirks and bad behaviors that the
earlier version of Netscape and IE exhibited and which many web sites
still rely on. One of those little quirks, is the concept of a table
with a height. Neither HTML 4.0 nor XHTML allow a height attribute on the table element. The only way a height on a table will render is if the browser is in Quirks mode.
The main indicator that IE and Firefox look for when determining
which mode to use is the presence of a valid doctype at the top of the
page. A valid doctype must include a link to the DTD, like so:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
Because the doctype that Adlai is using is invalid (missing the link
to the dtd), IE and Firefox switch to Quirks mode and the invalid
height attribute is obeyed. The switch from XHTML to HTML 4.0 in the
doctype doesn't really have much of an effect.
Now I'm not saying you shouldn't put out a website that forces the
browser into Quirks mode, though I don't believe you should develop any
NEW applications that force the browser into Quirks mode. It is
important either way, however, to know what is happening in the browser
because it will affect the way many html tags are rendered.