Importance of Doctypes and browser behaviour
I was trying to center a DIV today and couldn’t figure out why it wasn’t working as expected in IE7.
To center a DIV, you can use CSS and set the margin-left, margin-right to auto and give the DIV a fixed width. However, a bug in IE6 required that you also set the text-align of the body to center.
I noticed that http://www.textdrive.com/ homepage didn’t need this text-align workaround and didn’t know why. The reason turned out to be the DOCTYPE that was used. Using this DOCTYPE, you don’t need that text-align hack.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>