亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使iframe響應

使iframe響應

開心每一天1111 2019-08-09 17:33:30
使iframe響應當我嘗試實現HTML和CSS以滿足我的需求時,我沒有相同的結果/成功。我創建了自己的JS小提琴,所以我可以告訴你它對我來說不起作用。我確定它與我正在使用的iFrame的類型有關(例如,產品圖像可能需要響應或者其他什么?)我主要擔心的是,當我的博客讀者在他們的iPhone上訪問我的博客時,我不希望所有內容都是x寬度(我的所有內容都是100%)然后iFrame行為異常并且是唯一更廣泛的元素(因此堅持超出所有其他內容 - 如果這是有道理的??)無論如何,有誰知道為什么它不起作用?謝謝。這是MY JSFIDDLE的HTML和CSS(如果你不想點擊鏈接):<div class="wrapper">   <div class="h_iframe">     <!-- a transparent image is preferable -->     <img class="ratio" src="http://www.brightontheday.com/wp-content/uploads/2013/07/placeholder300.png" />     <iframe frameborder='0' height='465px' width='470px' scrolling='no' src='http://currentlyobsessed.me/api/v1/get_widget?wid=30&blog=Brighton+The+Day&widgetid=38585'       frameborder="0" allowfullscreen></iframe>   </div></div>這是附帶的CSS:.wrapper {   width: 100%;   height: 100%;   margin: 0 auto;   background: #ffffff;}.h_iframe {   position: relative;}.h_iframe .ratio {   display: block;   width: 100%;   height: auto;}.h_iframe iframe {   position: absolute;   top: 0;   left: 0;   width: 100%;   height: 100%;}
查看完整描述

3 回答

?
素胚勾勒不出你

TA貢獻1827條經驗 獲得超9個贊

嘗試使用此代碼使其響應

iframe, object, embed {
    max-width: 100%;}


查看完整回答
反對 回復 2019-08-09
?
滄海一幻覺

TA貢獻1824條經驗 獲得超5個贊

我找到了Dave Rupert / Chris Coyier的解決方案。但是,我想讓卷軸可用,所以我想出了這個:

// HTML

<div class="myIframe"> 
   <iframe> </iframe> </div>

// CSS

.myIframe {
     position: relative;
     padding-bottom: 65.25%;
     padding-top: 30px;
     height: 0;
     overflow: auto; 
     -webkit-overflow-scrolling:touch; //<<--- THIS IS THE KEY 
     border: solid black 1px;} .myIframe iframe {
     position: absolute;
     top: 0;
     left: 0;
     width: 100%;
     height: 100%;}


查看完整回答
反對 回復 2019-08-09
  • 3 回答
  • 0 關注
  • 666 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號