Reputation: 5717
Simple one that doesn't seem to want to work..
I want to centre a div inside a 100% wide div.
HTML.
<div id="body-outside">
<div id="body-inside">
content
</div>
</div>
CSS.
#body-outside{
width:100%;
float:left;
background-color:#F7B3DA;
}
#body-inside{
width:1280px;
margin:0 auto;
background-color:#F7B3DA;
float:left;
}
The content is staying on the left of the screen at the moment. Any ideas?
Thanks.
Upvotes: 0
Views: 92
Reputation: 21
You may also want to think about using text-align: center in the body outside portion.
Upvotes: 2
Reputation: 15379
Get rid of float:left;
. This pushes it to the left despite setting the margin to auto.
Upvotes: 5