0

iframeの上部から300pxを非表示にする必要があります。私はオーバーフローでそれを隠そうとしました:cssに隠されていますが、iphoneまたはipadでは機能しません。どうすればそれを解決できますか?

私のHTMLコード

<div class="iframe-wrapper">
  <div class="iframe-content">
    <iframe src="http://my_url" width="940" height="900" frameborder="0" scrolling="no" </iframe>
  </div>
</div>

私のCSS

.iframe-wrapper {
    position: relative; 
    overflow: hidden;
    width: 940px; 
    height: 600px;
}
.iframe-content {
    position: absolute; 
    top: -300px;
}
4

1 に答える 1

0

私はあなたのコードからデモを作成しましたが、私の提案と一緒に動作しているようです:

html:

<div class="iframe-wrapper">
  <div class="iframe-content">
      <iframe src="http://www.google.com" width="400" height="500" frameborder="0" scrolling="no"/>
  </div>
</div>

CSS:

.iframe-wrapper {
    position: relative; 
    overflow: hidden;
    width: 400px; 
    height: 300px;
    border: 5px solid orange;
    margin: 20px;
    background: red;
}

.iframe-content {
    position: absolute;
    top: -300px;
}

iframe { background: blue; }

デモ - http://jsfiddle.net/MteRS/

幅/高さを変更して、jsfiddle 出力パネルに少し収まるようにしました。

于 2013-01-29T11:31:11.143 に答える