HTML
<div id="parentDiv">
<div id="header">
</div>
<div id="middle">
</div>
<div id="footer">
</div>
</div>
Image の幅が 300px だとします。
CSS
#header
{
width:300px;
height:100px;
background-image: url("header.png");
background-repeat: no-repeat;
}
#middle
{ width:300px;
height:400px;
background-image: url("middle.png");
background-repeat: repeat-y;
/*If the width will be bigger than the actual
width of the image, then add:
background-repeat: repeat-x;
*/
}
#footer
{
width:300px;
height:100px;
background-image: url("footer.png");
background-repeat: no-repeat;
}
background-repeatについての詳細。
画像が繰り返されることに注意してください。これは見栄えがよくありません。中央に固定の高さを与えて使用することをお勧めします。overflow:auto;
これにより、コンテンツがサイズを超えたときにスクロールバーが作成されます。