css显示不出背景图片,路径没有错误,css和html和图片都在一个文件夹下

2025-03-10 21:04:33
推荐回答(3个)
回答1:

#main{
position:relative;
height:3600px;
width:1440px;
z-index:-1;
background:url("background.jpg") no-repeat center rgb(0,0,0);
}

附注:rgba属于css3,IE的低版本不支持的

回答2:

背景图片前面的语法错了,请学习CSS语法。
#main{
position:relative;
height:3600px;
width:1440px;
background:url("background.jpg") no-repeat center;
}
你的z-index设置-1什么意思?还有那个颜色,我都去掉了。

回答3:

#main{
    position: relative;
    height: 3600px;
    width: 1440px;
    z-index: -1;
    background:url("background.jpg") rgba(0, 0, 0, 0) no-repeat center;
}