IE6, DocTypes, and CSS Horizontal-Align
So I was working on a fairly simple site today, and it is looking mighty fine in Firefox and IE7 and Netscape and such, but then I saw it in IE6 and it was rubbish! Instead of having a fixed width and being centered horizontally in the browser, it filled the browser from edge to edge.
My first couple of attempts fixed the width problem, but it would always align itself right on the left edge.
Turns out IE6 is pretty quirky. A simple change to the DocType info fixed the problem and it all looks as it should now.
What I had (which was causing alignment problems in IE6):
<?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”><html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
<head>
…
What I have now (and works everywhere):
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
“http://www.w3.org/TR/1999/REC-html401-19991224″>
Tags:
cat | code | css | Discoveries | head | html | ie6 | quirks | red
Related Posts:
3000 Miles to the Trials | A Sound of Thunder Teaser | Ant Renamer Review | ASP List Directory 1.0 | ASP List Directory 2.0

