0

問題Fiddleのフィドルをセットアップしました。私の要件は何ですか?ヘッダーと背景画像のみを修正する必要があります。コンテンツはスクロールする必要があり、フッターもコンテンツとともにスクロールする必要があります。

CSS

body{
    margin: 0;
}

header{
    height: 50px;
    background: black;
    width: 100%;
}

section{
   background: url(http://dummyimage.com/600x400);
    height: 400px;
    repeast: no-repeat;
}

footer{
    height: 50px;
    background: black;
    position: fixed;
    width: 100%; 
}

.clearfix{
    width: 960px;
    height: 400px;
    margin-left: auto;
    margin-right: auto;
    border: 5px solid #fff;

}

HTML

<header></header>
<section>
    <div class="clearfix">
        What my requirement is? I want the footer and background image to be position fixed and the footer should be scrolling with the large content.
    </div>
</section>
<footer></footer>

みんなありがとう。

4

1 に答える 1

2

overflow:scroll;コンテンツのスクロールに使用

.clearfix{
    width: 960px;
    height: 400px;
    margin-left: auto;
    margin-right: auto;
    border: 5px solid #fff;
    overflow:scroll;
}

div内にフッターを書くことができます。これにより、フッターがコンテンツでスクロールされます

于 2013-08-07T05:12:52.277 に答える