iframe:切掉顶部
Iframe: Cut off the top
我阅读了下面有关使用 iframe 包装器和覆盖隐藏 iframe 底部部分的文章。
Iframe: Cut off the bottom
我想做同样的事情,但从顶部而不是底部。我需要在下面更改什么 css
#iframe-wrapper {
position:relative;
}
#iframe-overlay { /* Adjust values as needed */
height:17px;
width:480px;
background-color:#fff;
position:relative;
top:-24px;
left:5px;
}
您可以通过在 iFrame 包装器中放置绝对叠加层来实现此目的。然后您可以使用“顶部”或“底部”属性.
来定位它
我举了两个例子。一个在上面,一个在下面。
#iframe-wrapper {
position:relative;
background: red;
width: 300px;
height: 300px;
}
#iframe-overlay-top {
height:17px;
width:100%;
background-color: green;
position:absolute;
top: 0;
left:0;
}
#iframe-overlay-bottom {
height:17px;
width:100%;
background-color: blue;
position:absolute;
bottom: 0;
left:0;
}
<div id="iframe-wrapper">
<div id="iframe-overlay-top"></div>
<div id="iframe-overlay-bottom"></div>
</div>
我阅读了下面有关使用 iframe 包装器和覆盖隐藏 iframe 底部部分的文章。 Iframe: Cut off the bottom
我想做同样的事情,但从顶部而不是底部。我需要在下面更改什么 css
#iframe-wrapper {
position:relative;
}
#iframe-overlay { /* Adjust values as needed */
height:17px;
width:480px;
background-color:#fff;
position:relative;
top:-24px;
left:5px;
}
您可以通过在 iFrame 包装器中放置绝对叠加层来实现此目的。然后您可以使用“顶部”或“底部”属性.
来定位它我举了两个例子。一个在上面,一个在下面。
#iframe-wrapper {
position:relative;
background: red;
width: 300px;
height: 300px;
}
#iframe-overlay-top {
height:17px;
width:100%;
background-color: green;
position:absolute;
top: 0;
left:0;
}
#iframe-overlay-bottom {
height:17px;
width:100%;
background-color: blue;
position:absolute;
bottom: 0;
left:0;
}
<div id="iframe-wrapper">
<div id="iframe-overlay-top"></div>
<div id="iframe-overlay-bottom"></div>
</div>