将背景图片添加到div(动态内容) [英] Add background images to div (Dynamic content)
本文介绍了将背景图片添加到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;
}
这篇关于将背景图片添加到div(动态内容)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文