Search code examples
htmlcsssocial-networkingfacebook-social-plugins

Aligning Social Media Buttons


I am trying to align our 3 social media buttons : Facebook/Twitter/Google +, evenly in a 393px width gap. They are aligned horizontally (facebook seems to be down about 2 px vertically on twitter/google+), however I am struggling a little and hoping someone can help.

Below is the code of the CSS/HTML buttons:

HTML

 <div class="nav-container2">
    <div id="nav3"><div class="fb-like" data-href="http://www.facebook.com/pages/Foscam-UK/222224154548563" data-send="false" data-layout="button_count" data-width="20" data-show-faces="false"></div>
    <a href="https://twitter.com/FoscamUK" class="twitter-follow-button" data-show-count="false">Follow @FoscamUK</a>  
    <div class="g-plusone" data-size="medium"></div>

CSS

.nav-container2 { width:940px; margin:auto; height:30px;}
#nav2 { width:547px; height:40px; float:right; margin:1px 0 0 0; font-size:105%; background:url(../images/bg-nav.png) 0 0 repeat-x; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; box-shadow:0 0 3px #ccc; }
#nav3 { width:393px; float:left; height:0px; margin-top:10px;}

Thanks a lot


Solution

  • Try this:

    <div class="nav-container2">
        <ul class="social-media-list">
            <li>
                <div class="fb-like" data-href="http://www.facebook.com/pages/Foscam-UK/222224154548563" data-send="false" data-layout="button_count" data-width="20" data-show-faces="false"></div>
            </li>
            <li>
                <a href="https://twitter.com/FoscamUK" class="twitter-follow-button" data-show-count="false">Follow @FoscamUK</a> 
            </li>
            <li> 
                <div class="g-plusone" data-size="medium"></div>
            </li>
        </ul>
    </div>
    

    CSS:

    .nav-container2 { width:940px; margin:auto; height:30px;}
    .social-media-list { width: 393px; }
    .social-media-list li { display:block; float: left; width:33.3%; text-align:center; margin: 0 auto;}
    

    This is just a guess because I'm not sure how this will fit in your page but that will give you a 393px wide block element with 3 evenly spaced list items.