DIV背景图片在Firefox下不显示,IE下正常
来源:百度知道 编辑:UC知道 时间:2024/05/25 01:59:11
在一个大的div里有2个横列(DIV),并且在大的div里加入背景图片。可是改好后,在Firefox下却无法正确显示背景图片。代码是这样的:
1.HTML(样本):
<div id="footer">
<div id="footer_left">Content1</div>
<div id="footer_right">Content2</div>
</div>
2. CSS:
#footer {
width:730px;
background-image: url(../images/bg.jpg);
background-repeat: repeat-y;
}
#footer_left {
float:left;
width:230px;
}
#footer_right{
float:left;
width:500px;
}
1.HTML(样本):
<div id="footer">
<div id="footer_left">Content1</div>
<div id="footer_right">Content2</div>
</div>
2. CSS:
#footer {
width:730px;
background-image: url(../images/bg.jpg);
background-repeat: repeat-y;
}
#footer_left {
float:left;
width:230px;
}
#footer_right{
float:left;
width:500px;
}
这是因为你的#footer_left 和#footer_right加了float:left,在FF里如果里面的元素加了float:left(right),它就不会被撑开的,也就是说的它的高度是0,如果正常显示,必须加上:overflow:auto,即:#footer {
width:730px;
background-image: url(../images/bg.jpg);
background-repeat: repeat-y;
overflow:auto;
}
sonichu正解,
或者把背景图直接写在div的样式里
<div id="footer">
<div id="footer_left" style="background-image:url(images/bg_images/bg_200707090606106.jpg)">Content1</div>
<div id="footer_right">Content2</div>
</div>
DIV+CSS 在FIREFOX中显示的问题
DIV+CSS在IE中显示是好的,在Firefox 中就不行了
div+css 如何改变背景图片大小
div+css 在ie和firefox中显示不同的问题
怎样才能使加了边框的DIV高度在IE和Firefox中相同?
用div+css布局页面时,IE7显示没有作用?而在Firefox中的显示正常。
firefox中的层浮动问题(div+css)
请教 纯CSS+DIV做出来的网页怎样在IE与Mozilla Firefox当中都正常显示
为什么在我用div定义的absolute高度位置的时候, 在ie下与在firefox里显示的位置不一样啊,
为什么用CSS设置<DIV>的背景图片无法显示?