Jump to content

[SOLVED] Div not centering


Btown2

Recommended Posts

was wondering if anyone could explain why my container div wont center? my book says this should work but its not in IE7.

 

body
{
margin: 0;
padding: 0;
}

div
{
border: 1px solid #000;
padding: 20px;
margin: 10px;
background: #fff;
}

#container
{
margin: 0 auto;
width: 750px;
padding: 20px;
border: 1px solid #000;
background: #CCC;
}

.box
{
margin: 10px;
padding: 20px;
border: 1px solid #000;
background: #09f;
width: 75%;
}

.box p
{
color: #00f;
font-size: 2em;
}

 

heres the markup

 

<html>
<head>
<title>Testing css</title>
<link rel="stylesheet" type="text/css" href="css.css">
</head>
<body>
<div id="container">
<p>content</p>

<div class="box">
	<p>im in a box</p>
</div>

<div class="box">
	<p>me 2</p>
</div>

<div>
<p>im boxed?</p>
</div?
</div>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/114374-solved-div-not-centering/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.