0

I'm struggeling a bit with the sharebuttons for social media (Twitter, Facebook, Google+) because the facebook button is a few pixels more down than the other two. I have the feeling I tried everything in my knowledge, by adding or removing divs, margin, padding etc.

This is the HTML code:

<div class="sharebuttons">
  <div class="sharebutton"><div class="fb-share-button " data-layout="button" data-mobile-iframe="false"></div></div>
  <div class="sharebutton"><a href="https://twitter.com/share" class="twitter-share-button">Tweet</a></div>
  <div class="sharebutton"><div class="g-plus" data-action="share" data-annotation="none"></div></div>
</div>  

And the only CSS code from my part:

.sharebutton{
    display:inline; 
}

And the result is this:

enter image description here

Chris Spittles
  • 15,023
  • 10
  • 61
  • 85
Paul
  • 33
  • 1
  • 8
  • you have a nested div there causing havoc. you should be able to remove that `.fb-share-button` and place the attributes into its parent instead. – jbutler483 Apr 26 '16 at 10:07

3 Answers3

4

You need to vertically align them. Since text is on top I suggest apply this css:

.sharebutton {
    display: inline-block;
    vertical-align: bottom;
}

this way all buttons will flow to bottom of line and align properly keeping text on top.

Justinas
  • 41,402
  • 5
  • 66
  • 96
  • This didn't work for me in this case, I don't know why :/ but thanks for you answer! – Paul Apr 26 '16 at 06:44
1

You can add just float:left and some width looking for your site:

.sharebutton {
  display: inline-block;
  float: left;
  width:auto;
}
Jainam
  • 2,590
  • 1
  • 9
  • 18
0
.sharebutton {
   display: inline-block;
   vertical-align: top; // or bottom as per your needs
}
Mohammad Usman
  • 37,952
  • 20
  • 92
  • 95