[thelist] CSS centering in IE

Rob Day rday at tsl.state.tx.us
Wed Jan 28 12:03:42 CST 2004


Hi,
I'm trying to create a page that I thought would be really easy -- a single fixed-width column, with flexible height (dependent upon amount of content), centered on the page. I wrote a really simple page that I've tested it on Mozilla 1.4, Opera 7.23, Firebird 0.7, and IE 6 all on Windows 2000. It works just fine in everything except IE. In IE the column is all the way to the left. I found a page that does what I want without tables and works in IE (http://www.pfundernewmedia.com/shawn/), so I looked at the CSS, but I can't see what they're doing differently. In the CSS comments (http://www.pfundernewmedia.com/shawn/styles-site.css) there's a mention of a CSS hack, but I can't figure out what's going on. I also tried doing what this site suggested (http://www.quirksmode.org/css/centering.html), but I'm really trying to avoid using a table. Any pointers would be greatly appreciated. Thanks.
-Rob

Here's my code:
---------------
<?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">
<head>
<title>nothing to see here</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body {
	background-color: #cc9;
}
#container {
	background-color: #fff;
	width: 504px;
	margin-left: auto;
	margin-right: auto;
}
-->
</style>
</head>
<body>
<div id="container">
	<p>text</p>
</div>
</body>
</html>
---------------


More information about the thelist mailing list