D
damiensawyer
Hi,
I'm wondering if someone can help me with something that 'should' be
easy. What's more, it's something that I've done a dozen times, but
can't for the life of me figure out what I'm missing 'today'.
I'm trying to center a <div> using 'auto' margins.
The following works fine in FF, Chrome, Opera etc (in that the
#content block is centered). But not in IE.
Can someone please point out to me what I'm missing?
Thanks very much in advance,
Damien
---------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;
charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
<STYLE type="text/css">
* {border:0px; margin:0px;}
body {margin:10px;}
#content
{
background-color:Yellow;
margin-left:auto;
margin-right:auto;
width:300px;
}
</STYLE>
</head>
<body>
<div id="content">
<h1>Hello World</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Donec commodo magna nec purus. Integer sem nunc, vulputate at, aliquet
ut, eleifend ut, ante. Vivamus et sapien ut arcu ornare accumsan.
Nulla facilisi. Cum sociis natoque penatibus et magnis dis parturient
montes, nascetur ridiculus mus. Sed quis erat sed ligula rutrum
pulvinar. Nam placerat arcu ut arcu. Sed posuere, mi sit amet commodo
vulputate, mauris lorem pretium purus, volutpat venenatis arcu nunc ut
orci. Suspendisse potenti. Mauris congue. Sed felis. Ut pellentesque
lectus quis quam. In lacinia lacus nec metus.</p>
<p>Nunc eu diam. Praesent et diam vel justo pellentesque
malesuada. Donec sed diam condimentum neque auctor molestie. Donec
condimentum commodo erat. Vestibulum ac libero eu libero faucibus
vestibulum. Cras lorem urna, venenatis ut, rutrum vel, dapibus et,
magna. Maecenas convallis hendrerit mauris. Maecenas ut nibh id erat
hendrerit pretium. Pellentesque at libero. Vestibulum placerat. In hac
habitasse platea dictumst. Aenean euismod commodo mauris. In turpis
sem, dignissim non, viverra consequat, posuere ac, risus. Donec quis
quam quis lectus laoreet hendrerit. Curabitur vestibulum leo sed
massa. Fusce accumsan nulla vel mauris. Sed elementum dolor lobortis
mauris. Nunc sodales nunc vel purus. Donec vel sapien at diam dictum
faucibus. </p>
</div>
</body>
</html>
I'm wondering if someone can help me with something that 'should' be
easy. What's more, it's something that I've done a dozen times, but
can't for the life of me figure out what I'm missing 'today'.
I'm trying to center a <div> using 'auto' margins.
The following works fine in FF, Chrome, Opera etc (in that the
#content block is centered). But not in IE.
Can someone please point out to me what I'm missing?
Thanks very much in advance,
Damien
---------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;
charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
<STYLE type="text/css">
* {border:0px; margin:0px;}
body {margin:10px;}
#content
{
background-color:Yellow;
margin-left:auto;
margin-right:auto;
width:300px;
}
</STYLE>
</head>
<body>
<div id="content">
<h1>Hello World</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Donec commodo magna nec purus. Integer sem nunc, vulputate at, aliquet
ut, eleifend ut, ante. Vivamus et sapien ut arcu ornare accumsan.
Nulla facilisi. Cum sociis natoque penatibus et magnis dis parturient
montes, nascetur ridiculus mus. Sed quis erat sed ligula rutrum
pulvinar. Nam placerat arcu ut arcu. Sed posuere, mi sit amet commodo
vulputate, mauris lorem pretium purus, volutpat venenatis arcu nunc ut
orci. Suspendisse potenti. Mauris congue. Sed felis. Ut pellentesque
lectus quis quam. In lacinia lacus nec metus.</p>
<p>Nunc eu diam. Praesent et diam vel justo pellentesque
malesuada. Donec sed diam condimentum neque auctor molestie. Donec
condimentum commodo erat. Vestibulum ac libero eu libero faucibus
vestibulum. Cras lorem urna, venenatis ut, rutrum vel, dapibus et,
magna. Maecenas convallis hendrerit mauris. Maecenas ut nibh id erat
hendrerit pretium. Pellentesque at libero. Vestibulum placerat. In hac
habitasse platea dictumst. Aenean euismod commodo mauris. In turpis
sem, dignissim non, viverra consequat, posuere ac, risus. Donec quis
quam quis lectus laoreet hendrerit. Curabitur vestibulum leo sed
massa. Fusce accumsan nulla vel mauris. Sed elementum dolor lobortis
mauris. Nunc sodales nunc vel purus. Donec vel sapien at diam dictum
faucibus. </p>
</div>
</body>
</html>