CSS 样式 facebook 'like' 按钮

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3833936/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 22:51:48  来源:igfitidea点击:

Style facebook 'like' button

cssfacebookcoding-style

提问by mastodon

I'm struggling with this for a while now and without any success. Setting the style with jquery doesn't work, the same with after the facebook iframe. Is there a way to perform this task ?

我现在为此苦苦挣扎了一段时间,但没有任何成功。用 jquery 设置样式不起作用,与 facebook iframe 之后相同。有没有办法执行这个任务?

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

<style>
    .connect_widget_not_connected_text, .connect_widget_connected_text {
        color:white;
    }
    .connect_widget_connected_text a {
        color:#3B5998;
    }
</style>

<script type="text/javascript">
    $(function() { 
        $('.connect_widget_not_connected_text').css('color', 'white');
    });
</script>

回答by Nathan Totten

I'm sure that you can figure out a CSS trick to style the button, but you are violating facebook Terms of Service by doing so. You are REQUIRED to display the like button in one of their official styles.

我相信你可以找出一个 CSS 技巧来设置按钮的样式,但是你这样做违反了 Facebook 服务条款。您需要以他们的官方样式之一显示喜欢按钮。

回答by Clemens Helm

Alternatively, use a share link like

或者,使用共享链接,如

https://www.facebook.com/sharer.php?u=url_to_share&t=title_of_content

See https://developers.facebook.com/docs/share/for details.

有关详细信息,请参阅https://developers.facebook.com/docs/share/

回答by methodin

I don't think you can style an iframe content from a parent page in this fashion. You can try adding an id to the iframe and attempting to call it that way but even then I'm not sure it will work.

我认为您不能以这种方式从父页面设置 iframe 内容的样式。您可以尝试向 iframe 添加一个 id 并尝试以这种方式调用它,但即使如此,我也不确定它是否会起作用。

回答by Agent_x

回答by defau1t

Looks like you are using an iframe implementation and there is probably no way you use use this implementation and style it as you want. However you might want to display other ways of implementating Facebook Like button like using XFBML

看起来您正在使用 iframe 实现,并且您可能无法使用此实现并根据需要设置样式。但是,您可能希望显示其他实现 Facebook Like 按钮的方法,例如使用 XFBML