Facebook像固定页脚内的按钮框架

时间:2013-01-07 06:38:07

标签: javascript html css facebook-like sticky-footer

我想得到这样的东西

enter image description here

但我目前有这个

enter image description here

我已经尝试过一些方法来解决它,但我无处可去,我该怎么办?

以下是fiddle

我有一些定义,如:

#footer {
            padding: 20px;
            background-color: #000;
            color: #fff;
            font-size: 12px;
}

和这个iframe

<iframe src="FACEBOOKURL&amp;layout=button_count&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=20" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100%; height:20px;" allowTransparency="true">
</iframe>

2 个答案:

答案 0 :(得分:1)

使用左手浮动。

<div style="float:left">text</div>
<div style="float:left">iframe</div>

确保iframe宽度可以根据您的空间进行调整

检查一下 - http://jsfiddle.net/im4aLL/xjJsk/10/

答案 1 :(得分:1)

你也不需要float元素。一个更简单的解决方案就是删除iframe的width:100%

标记:

<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com/Eurekavi&amp;layout=button_count&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=20" scrolling="no" frameborder="0" style="border:none; overflow:hidden;  height:20px;" allowTransparency="true">

工作演示:http://jsfiddle.net/xjJsk/23/