【发布时间】:2021-01-02 10:01:10
【问题描述】:
我正试图强制 Facebook 嵌入占据页面的一半。通常在 CSS 中,我会使用width: 50%,但 Facebook 似乎将最大像素限制为 500,但我不希望这种情况发生。有解决办法吗?
这是我当前的代码:
iframe{
width: 100%; /*should take up the entire container, instead takes up 500px*/
}
<iframe src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2Feliotfiskguitar&tabs=timeline&width=340&height=500&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId" width="340" height="500" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe>
正如你在 sn-p 中看到的,它应该占据整个页面,但它却占据了 500px。
我还尝试使用 JQuery 来计算页面的宽度并将data-width 属性设置为以像素为单位的宽度,但同样,它的上限为 500 像素。
帮助表示赞赏。
谢谢
【问题讨论】:
-
@RaheelJunaid 遗憾的是它不起作用。感谢您的尝试!
标签: javascript html css facebook