Reputation: 469
I can't seem to center the social media buttons. the all-soc-share class right now is empty. How should I center them in css? (its a hassle to provide a fiddle)
The HTML code
<div class="col span-2-of-2 all-soc-share">
<div class="soc-share">
<!--FB SHARE-->
<div class="fb-share-button" data-href="http://example.com" data-layout="button_count"></div>
</div>
<div class="soc-share">
<!--Twitter SHARE-->
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://example.com" data-text="Dummy text" data-size="large">Tweet</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>
</div>
<div class="soc-share">
<!--Draugiem SHARE-->
<script type="text/javascript" src="//www.draugiem.lv/api/api.js"></script>
<div id="draugiemLike"></div>
<script type="text/javascript">
var p = {
link:"example.com",
text:"Dummy text ",
popup:true
};
new DApi.Like(p).append('draugiemLike');
</script>
</div>
</div>
The CSS
.soc-share{
float: left;
margin-right: 30px;
}
Upvotes: 0
Views: 70
Reputation: 1337
Not sure why you have the float left in there. Try this:
.soc-share{
display: inline-block;
margin-right: 30px;
}
.all-soc-share{
width: 100%;
text-align: center;
}
And here's a fiddle: https://jsfiddle.net/qaq9r4fs/
Upvotes: 1
Reputation: 7210
You could do it in pure css by providing
.theclasstocenter {
margin-left:auto;
}
Or you could download bootstrap and center those social buttons with the custom class "text-center."
Upvotes: 0