I have the following piece of HTML:
<ul id="downmenu">
<li class="copyright">
<div>© 2011. All rights reserved.</div>
</li>
<li class="twitter">
<img src="images/twitter.png" alt="" />
</li>
<li class="facebook">
<img src="images/facebook.png" alt="" />
</li>
</ul>
And the following piece of CSS:
#downmenu {
font-size:14px;
border-top: 1px solid #666;
clear: both;
list-style-type: none;
margin: 20px 0;
overflow: hidden;
padding: 11px 0 11px 34px;
width: 870px;
}
#downmenu li {
float:left;
}
#downmenu li.copyright {
margin-right:540px;
height:36px;
}
#downmenu li.copyright div{
margin: auto 0;
}
(I think) #downmenu li.copyright is set to 36px tall, and I want to centre vertically the div inside it. To achieve that I've used margin: auto 0;. But it isn't centered.
Any clue?
Remove the div altogether and use line-height to center your text.
Setting the line height equal to the height of the li will center it vertically.
#downmenu li.copyright {
margin-right:540px;
height:36px;
line-height:36px;
}
Try this:
#downmenu li.copyright {
margin-right:540px;
height:36px;
display: table-cell;
vertical-align: middle;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With