2

ここで確認するのが最も簡単です(願っています):http://jsfiddle.net/UG7un/

ページ全体を 20px の余白でカバーする固定ラッパーがあります。そのラッパー内でコンテンツをスクロールするにはどうすればよいですか?

<div id="wrap">
<div id="content">
    <p>How can I get this to scroll within this white content area only, using the native browser scroll?</p>
</div>
<div id="photo"></div>
</div>

html {
    background:url(http://i1210.photobucket.com/albums/cc406/Ingutuks/2012/P5211369.jpg) no-repeat center center fixed; 
    background-size:cover;
    }

#wrap {
    background:#fff;
    margin:20px;
    position:fixed;
    overflow:hidden;
}

#content {
    width:45%;
    padding:2.5%;
   float:left;
}

#photo {
    width:50%;
    background:url(http://i1351.photobucket.com/albums/p790/KrazyKobraRawr/Jojothecat_zps448af247.jpg) no-repeat center center;
    background-size:cover;
    float:right;
}
4

3 に答える 3

0

高さを指定する必要があります。

#content {
    overflow:auto;
    height:360px;
    width:45%;
    padding:2.5%;
   float:left;
}

http://jsfiddle.net/UG7un/1/

于 2013-05-02T21:05:53.070 に答える
0

こんな感じですか? http://jsfiddle.net/UG7un/3/

以下をコメントアウトしました。

position:fixed;

そしてJSの数行。

于 2013-05-02T22:21:59.550 に答える
0

私が正しく理解していれば overflow:auto;wrapdivで使用できます。

#wrap {
    background:#fff;
    margin:20px;
    position:fixed;
    overflow:auto;
}

wrapdivにスクローラーが表示されます。

于 2013-05-02T20:30:23.083 に答える