禁用/隐藏iframe滚动条?

时间:2019-09-21 13:44:17

标签: html wordpress iframe radio audio-player

我有一个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>

enter image description here

2 个答案:

答案 0 :(得分:1)

有很多方法。

在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>

答案 1 :(得分:0)

要删除边框,可以在样式代码中添加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"