Reputation: 9787
I have a simple div with a display: inline-block; and a wrap to center it. It appears a pixel at the bottom of the content. Do you know why and how to get rid of it?
Here is the problem to check: http://jsfiddle.net/8S8aH/
HTML:
<div class="wrap">
<div id="content"></div>
</div>
CSS:
body{
margin:0;
}
.wrap {
text-align: center;
background:red;
}
#content {
margin:0px auto;
text-align:left;
width:250px; height:100px;
display: inline-block;
background:whiteSmoke;
}
Upvotes: 2
Views: 1844
Reputation: 59799
Change the vertical-align
value on #content
#content {
display: inline-block;
vertical-align: bottom;
}
Upvotes: 1
Reputation: 4205
Personally, I prefer this to clear space in inline-block
elements.
#content:after{
content:'\00a0';
}
There are alternatives as well.
Upvotes: 1
Reputation: 40970
Use display: block
for content div
#content {
margin:0px auto;
text-align:left;
width:250px;
height:100px;
display: block;
background:whiteSmoke;
}
Upvotes: 1