0

I am trying to add Facebook Like , Twitter Follow and Youtube Subscribe buttons aligned centred in an HTML page. I was able to generate the code for each site using FB, Twitter and Youtube code. However, I am unable to align and center them in an organised manner. it worth noting also that it takes long time to load three buttons !

Here the code generated from the three sites: http://jsfiddle.net/5fcu2gs2/

<!-- Facebook Code -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like" data-href="https://www.facebook.com/facebook" data-layout="button" data-action="like" data-show-faces="true" data-share="false"></div>



<!-- Twitter Code -->
<a href="https://twitter.com/twitter" class="twitter-follow-button" data-show-count="false" data-show-screen-name="false">Follow @twitter</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>



<!-- Youtube Code -->
<script src="https://apis.google.com/js/platform.js"></script>

<div class="g-ytsubscribe" data-channel="Google" data-layout="default" data-theme="dark" data-count="hidden"></div>

Thanks in advance

Ahmed Taher
  • 999
  • 3
  • 11
  • 12

1 Answers1

0

So you want to vertically align them one the same height, and have them centered horizontally?

Put them into a container element each, and then align those vertically:

.social-button-container {
    display:inline-block;
    vertical-align: middle;
}

And add an outer container with text-align:center, to center them horizontally.

http://jsfiddle.net/5fcu2gs2/3/

(They don’t look perfectly vertically aligned though; that’s because they have different amounts of white space under the visible button. If you want to counter that, add position:relative to each container, and position them up or down a few pixels using top.)

CBroe
  • 91,630
  • 14
  • 92
  • 150
  • Thanks @CBroe , your point is valid as they are not perfectly aligned. I would rather stick with an option that makes them aligned well similar to here http://mashable.com/2013/07/24/youtube-subscribe-button/#o.8qWFbefOqx – Ahmed Taher Nov 21 '15 at 08:27