我想将iframe插入到具有以下要求的网页中:
iframe高度必须为100% - 它应该用其内容拉伸高度 .
iframe滚动条不应该是可见的,但页面滚动条应该与iframe内容的高度相关 .
iframe源来自不同的域 .
集成iframe后,网页应该是一个普通的网页 . 我将页面和iframe源页面设置为相互匹配 .
我通过搜索尝试了不同的解决方案,但到目前为止没有运气
请给我一个帮助
谢谢
用css作为
iframe{ height: 250px; // whatever you want }
Link DEMO
试试这个代码......
<!DOCTYPE html> <html> <head> <title>iframed site</title> <style> .restricted{ width:100%; height:100%; overflow-x: hidden; -ms-overflow-x: hidden; } </style> </head> <body> <iframe src="http://www.mukhesh-blog.blogspot.com" class="restricted"></iframe> </body> </html>
或这个....
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <title>iframe example</title> <style type="text/css"> html, body, div, iframe { margin:0; padding:0; height:100%; } iframe { display:block; width:100%; border:none; } </style> </head> <body> <div> <iframe src="http://example.org/"> <p><a href="http://example.org/">example.org</a></p> </iframe> </div> </body> </html>
2 回答
用css作为
Link DEMO
试试这个代码......
或这个....