Reputation: 2123
HTML:
<div class="wrapper">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
CSS:
.wrapper{
width:1000px;
text-align:center;
float:left;
}
.wrapper .box{
width:300px;
height:50px;
display:inline-block;
background:#F00;
margin:0 10px 10px 0;
overflow:hidden;
}
I want to center all div in wrapper div like this;
Above codes work fine in IE8,IE9,Chrome,Safari,Opera,FF but not working in IE7. When I open page in IE7, page looks like this;
If I use float:left, the problem seems to be solved but all divs based on the left. How can I solve this?
Upvotes: 1
Views: 3953
Reputation: 5812
Inline-block doesn't work in IE7.
You have to use zoom:1 and display:inline as a hack or without hack from a different css only for ie7.
.wrapper .box{
width:300px;
height:50px;
display:inline-block;
*display: inline;
*zoom:1;
background:#F00;
margin:0 10px 10px 0;
overflow:hidden;
}
Upvotes: 4