限制HTML5 Facebook评论框的大小

oxu*_*ser 3 html css facebook

我试图从下面生成的代码中限制Facebook评论的垂直高度,但我不知道如何限制评论框的垂直高度.(对于宽度,data-width参数由facebook提供).有谁知道我怎么做到这一点?

<html>
<head></head>
<body>
<div id="fb-root"></div>
<script>(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>
<div class="fb-comments" data-href="example.com" data-num-posts="2" data-width="500">    </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

谢谢!

jbn*_*unn 5

不幸的是FB目前不允许使用IFRAME方法,只允许使用HTML5和XFBML,所以我用来解决这个问题的解决方案就是用另一个div设置滚动来覆盖标签,例如::overflow-y"

<div id="fb_comments">
    <fb:comments href="http://example.com/" num_posts="10" width="500"></fb:comments>
</div>
Run Code Online (Sandbox Code Playgroud)

我对fb_comments的造型是:

#fb_comments { height:400px; padding-bottom:20px; overflow-y: scroll; }
Run Code Online (Sandbox Code Playgroud)