[英]How can I target an element that is in an iFrame within another iFrame?
[英]How can i remove an element within an iframe?
例如,我想从 iframe 中删除“导航栏”。 我该怎么做?
<!DOCTYPE html>
<html>
<body>
<h2>HTML Iframes</h2>
<p>I want to remove the navigation bar:</p>
<iframe id="" class=" " scrolling="no" style="width:1000px; height: 1500px; overflow: hidden;" src="https://www.w3schools.com/" title="Iframe"></iframe>
</body>
</html>
您无法操作iframe
中的内容,但是,如果您要隐藏的内容是页面顶部的水平导航部分,您始终可以将iframe
包裹在具有overflow:hidden
的div
中,然后向上移动内容具有top
属性。
像这样:
div { overflow:hidden; } iframe { position:relative; top:-120px; border:0; width:100%; }
<h2>HTML Iframes</h2> <p>I want to remove the navigation bar:</p> <div> <iframe id="" class=" " scrolling="no" style=" height: 1500px; overflow: hidden;" src="https://www.wikipedia.org/" title="Iframe"></iframe> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.