Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS块(div)背景图像和负边距_Html_Css - Fatal编程技术网

Html CSS块(div)背景图像和负边距

Html CSS块(div)背景图像和负边距,html,css,Html,Css,当块(DIV)有背景图像(无重复)时,如果块有负边距,则不显示,是否有人在Opera(和其他)上有错误,但IE6(这里一切正常)没有?大概是这样的: #slide_desc {height: 60px;margin-top: -84px;background: url('back/slide_desc.png') no-repeat;} IE6,IE7-好的 IE8,Opera,Firefox,Chrome,Safari-BUG 没有背景图像,没有PNG黑 仅此HTML: <div id

当块(DIV)有背景图像(无重复)时,如果块有负边距,则不显示,是否有人在Opera(和其他)上有错误,但IE6(这里一切正常)没有?大概是这样的:

#slide_desc {height: 60px;margin-top: -84px;background: url('back/slide_desc.png') no-repeat;}
IE6,IE7-好的 IE8,Opera,Firefox,Chrome,Safari-BUG 没有背景图像,没有PNG黑 仅此HTML:

<div id="slider"> <img src="img/slide.jpg" height="300" width="730" border="0" /> <div id="slide_desc"> Lorem ipsum </div> </div> 
如果我添加position:relative-在Opera中工作,但在IE6中不工作 如果我换位置:固定-一切都很好,但我不确定这是解决问题的完美方式。
由于滚动,此滚动条也会滚动。

看起来您只需要给它一个高度和宽度,否则它只与该div中的文本一样大:

这是一把小提琴:

另一个是原始div中的背景:

请展示你的整个css和html,我不认为IE6做了opera和其他人做不到的事情-我确信你的代码有问题,这是IE的错误,你想做什么就做什么。请编辑你的问题以添加信息,在评论中写下这一点非常混乱。如果在家里还没有人回答,我会尽量解决这个问题。但如果不建议将滑块图像放在背景中?我不明白这意味着什么
#slide_desc {margin-top: -84px;background: url('slide_desc.png') no-repeat;}