Making a div sit centrally using margin: 0 auto?
I'm trying to have 2 div's on my page at position centrally at http://s361608839.websitehome.co.uk/pt-build/templatebuild/ with #pricing and #bmicalculator in particular.
In the CSS for #pricing it is set as follows:
#pricing {
width: 850px;
margin: 0 auto;
border-bottom: 1px solid #ededed;
font-family: 'Maven Pro', sans-serif;
font-size: 13px;
color: #4a4a4a;
padding: 120px 350px 30px 0;
height: 300px;
}
As you can see there is margin: 0 auto; on one of the lines and I was expecting this to position the div in the middle开发者_StackOverflow of the screen, and not to the left as it is currently showing.
Any help appreciated... thanks!
You've got a massive right padding padding: 120px 350px 30px 0;
that's giving the appearance of pushing it over to the left.
If it's still going to the left when you get rid of this, you're probably viewing it in an earlier version of IE, and need to add text-align: center;
to your body.
精彩评论