I have four icons I've set to display inline and I'm now trying to center the list they're contained in within a div.
Here's the HTML:
<div id="social_media">
<ul>
<li><a href="http://wwww.facebook.com"><img src="../images/social_media_icons/facebook_icon.png"></a></li>
<li><a href="http://wwww.wikia.com"><img src="../images/social_media_icons/wikia_icon.png"></a></li>
<li><a href="#"><img src="../images/social_media_icons/rss_icon.png"></a></li>
<li><a href="#"><img src="../images/social_media_icons/mail_icon.png"></a></li>
</ul>
</div>
And the CSS:
#social_media
{
width:220px;
margin:10px auto;
padding:0 2px;
}
#social_media ul li
{
display:inline;
margin:0 3px;
list-style-type:none;
}
The four icons are 48px square for a total of 192px wide, and each have horizontal margins of 3px for another 24px wide, adding to the whole list being 216px wide. The div they're contained in (social_media) is 220px wide with 2px of horizontal padding for 216px of space in which the list, in theory, should fit perfectly.
However, when I actually do this, the fourth icon gets bumped down to the next row, directly under the first. When I change 3px to auto, they all fit on the same row, but are too close together. And regardless of what I do, the list is aligned to the left instead of the center where it's supposed to be.
Help?