0
我有这个页面:中心对准Facebook的分享按钮
http://www.comehike.com/hiking.php
<div style="align:center">
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#appId=217585988283772&xfbml=1"></script>
<fb:like href="" send="true" width="450" show_faces="false" action="recommend" font=""></fb:like>
</div>
而且我使用此代码尝试中心对齐Facebook的分享按钮,但它不会发生。
任何想法如何我可以居中对齐它?
是什么呢? - 谢谢! – Genadinik
你居中div的方式是设置宽度等于div的内容,然后加上“margin:0 auto;”属性。我认为“align:center”的意思是“text-align:center”,它只会将文本居中放置在元素的范围内。我看到你已经修改了一下你的代码,只显示“推荐”按钮,因此div的宽度必须随着内容的改变而改变。尝试100px。如果您使用Firefox,确定div内容宽度的好工具是https://addons.mozilla.org/en-US/firefox/addon./measureit/。 –
这也适用于Facebook页面插件。将宽度设置为500px,并为响应式嵌入添加'max-width:100%'。 –