问题
I'm trying to change the width of the Like button on my site, but for some reason it's not working. I've tried the HTML5, iFrame and XFBML versions, but they all get rendered to the same size. Any ideas on what I'm doing wrong? Code is below.
<!DOCTYPE HTML>
<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
</head>
<body>
<div class="fb-like" data-href="http://www.facebook.com" data-send="false" data-layout="button_count" data-width="2000" data-show-faces="false"></div>
<fb:like href="http://www.facebook.com" send="false" layout="button_count" width="3000" show_faces="false"></fb:like>
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com&send=false&layout=button_count&width=1600&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:1600px; height:100px;" allowTransparency="true"></iframe>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'MY_ID', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
oauth : true, // enable OAuth 2.0
xfbml : true // parse XFBML
});
// Additional initialization code here
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
</body>
</html>
回答1:
Minimum width size is 55px.
3000 is probably a bit too much. Try using the tool at http://developers.facebook.com/docs/reference/plugins/like/ to make a realistic sized button.
回答2:
I advise you please use this plugin for html5
<div class="fb-like" data-href="your_link_goes_here" data-send="true" data-width="450" data-show-faces="true"></div>
Thanks...
来源:https://stackoverflow.com/questions/8429092/change-the-width-of-a-like-button