標籤:
一般情況下我們很少用到iframe(架構),但有些特殊的情況下我們不得不使用iframe,那麼或許或遇到嵌套內容不全屏,網頁周圍有邊框,雙捲軸等等情況,下面來說一下處理技巧。
全屏與邊框處理:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Colin-iframe Test</title></head><body> <iframe src="https://www.baidu.com" height="100%" width="100%" id="frame_full" frameborder="0" scrolling="auto"></iframe></body></html>
基本可以滿足需求了吧,或許你細心使用會發覺還是不夠完美,因為過高的頁面會有雙捲軸,怎麼辦?
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Colin-iframe Test</title></head><body> <iframe src="https://www.baidu.com" height="100%" width="100%" id="frame_full" frameborder="0" scrolling="auto" onload="this.style.height=document.body.clientHeight-50"></iframe></body></html>
這樣是不是沒有了?
當然,還可以這樣:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Colin-iframe Test</title><style type="text/css"> html{overflow:hidden;}</style></head><body> <iframe src="https://www.baidu.com" height="100%" width="100%" id="frame_full" frameborder="0" scrolling="auto" ></iframe></body></html>
-完-
iframe架構嵌套技巧(全屏,去雙捲軸)