iframe架構嵌套技巧(全屏,去雙捲軸)

來源:互聯網
上載者:User

標籤:

一般情況下我們很少用到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架構嵌套技巧(全屏,去雙捲軸)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.