jquery - 内嵌 facebook 和 google + 按钮的位置?

标签 jquery html facebook-like google-plus

有没有人有什么技巧可以在页面上对齐这两个按钮?默认情况下,iframe 版本的 facebook like 按钮显示在 google plus 按钮下方,反之亦然。是否有任何 CSS 技巧可以使它们保持内联?

这是我目前的尝试

<div style="float:left;width:100px;">
    <!-- Place this tag where you want the +1 button to render -->
    <g:plusone></g:plusone>

    <!--  Place this tag after the last plusone tag -->
    <script type="text/javascript">
        (function() {
            var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
            po.src = 'https://apis.google.com/js/plusone.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
        })();
    </script>
</div>
<div style="float:left;width:auto;">
    <iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fmy_site&amp;layout=button_count&amp;show_faces=false&amp;width=350&amp;action=like&amp;font=lucida+grande&amp;colorscheme=light&amp;height=40" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:350px; height:30px;" allowTransparency="true"></iframe>
</div>  

最佳答案

将它们放在一个列表中 - 这是我所做的(请原谅 jsp)

<ul class="like-buttons">
<li class="g-plus-one">
    <g:plusone count="false"></g:plusone>
</li>
<li class="twitter-like">
    <a href="http://twitter.com/share" class="twitter-share-button" data-url="<%= url %>" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</li>   

<li class="fb-like">
    <iframe src="http://www.facebook.com/plugins/like.php?href=<%= facebookUrl %>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=dark&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:350px; height:30px; color:#fff!important;" allowTransparency="true"></iframe>
</li>

还有CSS:

ul.like-buttons{
float: left;
list-style: none;
margin: 5px 0 20px 0;
padding: 0;
width: 100%;
}

ul.like-buttons li{
    display: block;
    float: left;
    margin-right: 10px;
}
li.twitter-like{
    margin-top: 2px;
}

关于jquery - 内嵌 facebook 和 google + 按钮的位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7584374/

相关文章:

javascript - 日期选择器添加 css 日期

javascript - Jquery delegate() 已弃用,那么如何监听动态创建对象事件

php - 跟踪 For 循环的最后一个

javascript - 单击子div时需要获取父div的文本

javascript - sharp (#) (e.g. #{$variable}) 在 SCSS 中是什么意思?

facebook-like - Facebook 点赞按钮最小宽度

jquery - 在调用 .css() 后触发事件(保存当前样式)?

Jquery 在 IE 中单击 DIV 仅在文本上触发,而不是在 DIV 中的任何位置触发...?

javascript - 如何从Facebook的喜欢按钮 Conceal 发送按钮但不 Conceal 添加评论并发送到Facebook框架

ajax - Laravel/AJAX 点赞按钮错误 : Request failed with status code 404