将背景图片添加到div(动态内容)
问题描述:
我有一个DIV ...
I have a DIV ...
<div id="content">
</div>
现在...在设计中,如果你认为它是一个矩形页眉和页脚是不同的,所以我不能只创建一个1px的背景图片并重复。
Now...In the design and if you think of it as a rectangle has the top as a header and also the footer is different so I cannot just create a 1px background image and repeat it.
我将不得不做一些像:
<div id="content">
<div id="header">This will have a fixed bg image</div>
<div id="body-content">This will have a repeated bg image and it's the part that can grow.</div>
<div id="footer-content">THis will content a fixed bg image for the footer</div>
</div>
任何人都可以建议最好的方式来处理这种设计CSS明智吗?
Can anyone advise on the best way to handle this kind of design CSS wise please?
答
#header
{
background-image: url('header.png');
background-repeat: no-repeat;
}
#body
{
background-image: url('body.png');
background-repeat: repeat-y;
}
#footer
{
background-image: url('footer.png');
background-repeat: no-repeat;
}