[thelist] Netscape 6: Doctype Declarations Can Break Table Layouts

Aylard JA (James) jaylard at equilon.com
Fri Dec 22 15:38:52 CST 2000


	After struggling to determine why some pixel-precise, table-based
layouts of mine were breaking in Netscape 6, I finally determined that the
URI I included in the doctype declaration was at the root of the problem.
Before anyone asks, the html in question passed the W3C validator using the
loose dtd.
	Even so, when Netscape 6 rendered the page, it added vertical space
to some table cells (incidentally, I found that setting the CSS line-height
property to the equivalent of the table-cell height fixed the problem in
Netscape 6, but caused horrible side-effects in Netscape 4.x).
	As I said, the key appears to be the dtd URI used in the doctype
declaration. For instance:

This works:

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

These don't:

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

	The preceding doctype declaration is cited as "typical usage" in the
HTML 4.01 spec itself
(http://www.w3.org/TR/1999/REC-html401-19991224/sgml/loosedtd.html). I'm not
sure where I got this next one, but the URI is good and it validates:

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

	In fact, Netscape 6 treats these alternative URIs the same way it
treats a made-up URI, leading me to conclude that the first URI must be
hard-coded into Netscape 6. So, bottom line: if you're writing valid,
transitional html that includes a doctype declaration, use the URI at the
top above. I suspect that this would be true of the equivalent strict and
frameset dtds, as well, but I haven't tested them yet.

James Aylard

More information about the thelist mailing list