I added the FB sharing code inside the div with any background image that I wanted to display (in this case, the Facebook logo in 64x64), and set the opacity to zero. I used Transform: Scale to scale the widget (14x17 by default) to the size of the parent div.
HTML:
<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.4"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <div id="fb-share" class="social" style="background-image: url(/assets/images/FB-f-Logo__blue_144.png);"> <div class="fb-share-button" data-href="http://my.website.com" data-layout="icon"></div> </div>
CSS
.fb-share-button { opacity: 0; transform: scale(4.5); transform-origin: top left; }
Eric Paquette
source share