嵌入式Twitter Widget高度问题

war*_*err 7 css twitter

我正在尝试将Twitter小部件添加到我的网站,但我对小部件的高度有问题.有时它可以工作,有时它忽略高度值并拉伸页面,以便底部有很多空白空间(将小部件拉伸到7847px).我已经尝试在代码中添加高度并设置DIV高度,但它仍然可以.这是我在Twitter上使用的代码

<a class="twitter-timeline" data-chrome="nofooter noheader noborders noscrollbar transparent" height='350' data-tweet-limit="5" data-dnt="true" href="https://twitter.com/Talk_AVFC/villa-players" data-widget-id="362602509207994368">Tweets from @Talk_AVFC/villa-players</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
Run Code Online (Sandbox Code Playgroud)

有人有这个问题,知道修复吗?

问题演示在http://richardawarner.co.uk/astonvillastuff/(在Twitter标签上)

Mat*_*ock 8

可以通过向链接添加数据属性来设置最大宽度和高度:

<a class="twitter-timeline" data-width="350" .... >
Run Code Online (Sandbox Code Playgroud)

设置显示的窗口小部件的高度,覆盖使用窗口小部件ID存储的值.必须大于200像素.

注意:指定tweet-limit参数时,height参数不适用

https://dev.twitter.com/web/embedded-timelines/parameters


小智 2

在 CSS 中定位 .twitter-timeline 类并声明其高度

.twitter-timeline {
    height: 350px !important;
}
Run Code Online (Sandbox Code Playgroud)