Disabling/Hiding iframe滚动条?

Disabling/Hiding iframe Scroll bar?

我有一个 HTML 代码用于嵌入我的 (laut.fm) 广播电台(广播播放器)。现在的问题是将代码输入到新的 wordpress 站点时,有一个丑陋的框架和一个丑陋的滚动条。该代码适用于 Iframe。

<figure><iframe width="1350" height="120" src="//laut.fm/widgets/player_for/radio-am-bad-2?player%5Bstations%5D=radio-am-bad-2&amp;player%5Bcolor%5D%5Bcolor%5D=white&amp;player%5Bshadow%5D=false&amp;player%5Bdisplay%5D%5Bborder%5D%5Bradius%5D=60px&amp;player%5Bcolor%5D%5Bbackground_to%5D=%23ff00ff&amp;player%5Bcolor%5D%5Bbackground_from%5D=%2300ff84&amp;player%5Bborder%5D%5Bcolor%5D=%23cccccc&amp;player%5Bborder%5D%5Bwidth%5D=0px&amp;player%5Bbutton%5D%5Bcolor%5D%5Bbackground_to%5D=%23000000&amp;player%5Bbutton%5D%5Bcolor%5D%5Bbackground_from%5D=%23000000&amp;player%5Bbutton%5D%5Bborder%5D%5Bcolor%5D=%23333333&amp;player%5Bbutton%5D%5Bborder%5D%5Bw[enter image description here][1]idth%5D=2px"></iframe></figure>

有很多方法。

在 iframe 标签中添加 scrolling="no"style="border:0;"

<figure><iframe width="1350" height="120" scrolling="no" style="border:0;" src="//laut.fm/widgets/player_for/radio-am-bad-2?player%5Bstations%5D=radio-am-bad-2&amp;player%5Bcolor%5D%5Bcolor%5D=white&amp;player%5Bshadow%5D=false&amp;player%5Bdisplay%5D%5Bborder%5D%5Bradius%5D=60px&amp;player%5Bcolor%5D%5Bbackground_to%5D=%23ff00ff&amp;player%5Bcolor%5D%5Bbackground_from%5D=%2300ff84&amp;player%5Bborder%5D%5Bcolor%5D=%23cccccc&amp;player%5Bborder%5D%5Bwidth%5D=0px&amp;player%5Bbutton%5D%5Bcolor%5D%5Bbackground_to%5D=%23000000&amp;player%5Bbutton%5D%5Bcolor%5D%5Bbackground_from%5D=%23000000&amp;player%5Bbutton%5D%5Bborder%5D%5Bcolor%5D=%23333333&amp;player%5Bbutton%5D%5Bborder%5D%5Bw[enter image description here][1]idth%5D=2px"></iframe></figure>

要去除边框,您可以在样式代码中添加style="border:none"

要删除滚动条,最好的方法是增加 iframe 的高度,使其适合内容。作为替代方法,您可以将 scrolling="no" 添加到 html 元素,该元素无效 HTML。目前大多数浏览器都支持它,但将来可能会改变。

<figure><iframe width="1350" height="125" style="border:none" src="//laut.fm/widgets/player_for/radio-am-bad-2?player%5Bstations%5D=radio-am-bad-2&amp;player%5Bcolor%5D%5Bcolor%5D=white&amp;player%5Bshadow%5D=false&amp;player%5Bdisplay%5D%5Bborder%5D%5Bradius%5D=60px&amp;player%5Bcolor%5D%5Bbackground_to%5D=%23ff00ff&amp;player%5Bcolor%5D%5Bbackground_from%5D=%2300ff84&amp;player%5Bborder%5D%5Bcolor%5D=%23cccccc&amp;player%5Bborder%5D%5Bwidth%5D=0px&amp;player%5Bbutton%5D%5Bcolor%5D%5Bbackground_to%5D=%23000000&amp;player%5Bbutton%5D%5Bcolor%5D%5Bbackground_from%5D=%23000000&amp;player%5Bbutton%5D%5Bborder%5D%5Bcolor%5D=%23333333&amp;player%5Bbutton%5D%5Bborder%5D%5Bw[enter image description here][1]idth%5D=2px"></iframe></figure>
<!--                increased height ^^^         ^^^^^^^^^^^ style code to remove border -->

但是我测试了你的代码,120似乎足够了。您发布的屏幕截图(带滚动条)改为使用 height="116"