Css 标题中未显示背景图像
我想将背景图像添加到Css 标题中未显示背景图像,css,background-image,Css,Background Image,我想将背景图像添加到标记,但图像不显示 header { background-image: url("/img/header-bg.jpg"); background-repeat: repeat-x; width: 100%; height: 105px; background: #fff; position: relative; display:block } 当我在Chrome中使用开发者工具时,我可以看到图像的URL是好的(我可
标记,但图像不显示
header {
background-image: url("/img/header-bg.jpg");
background-repeat: repeat-x;
width: 100%;
height: 105px;
background: #fff;
position: relative;
display:block
}
当我在Chrome中使用开发者工具时,我可以看到图像的URL是好的(我可以看到图像),但让我困惑的是,当我添加
background-image: url("/img/header-bg.jpg");
background-repeat: repeat-x;
作为Chrome中
标题的新样式规则,背景图像将显示。使用相同的背景属性将仅反映颜色。因此,请参考以下代码:
header {
background:#fff url("/img/header-bg.jpg") repeat-x;
background-repeat: repeat-x;
width: 100%;
height: 105px;
position: relative;
}
使用相同的背景属性将仅反映颜色。因此,请参阅以下代码:
header {
background:#fff url("/img/header-bg.jpg") repeat-x;
background-repeat: repeat-x;
width: 100%;
height: 105px;
position: relative;
}
将background
属性更改为background color
,或者在不需要时将其删除
background
是一个简写css属性,它将覆盖所有其他以前的样式
您的代码应该是:
header {
background-image: url("/img/header-bg.jpg");
background-repeat: repeat-x;
background-color: #fff;
width: 100%;
height: 105px;
position: relative;
display:block
}
或简写如下:
header {
background: #fff url("/img/header-bg.jpg") repeat-x;
width: 100%;
height: 105px;
position: relative;
display:block
}将background
属性更改为background color
,或者在不需要时将其删除
background
是一个简写css属性,它将覆盖所有其他以前的样式
您的代码应该是:
header {
background-image: url("/img/header-bg.jpg");
background-repeat: repeat-x;
background-color: #fff;
width: 100%;
height: 105px;
position: relative;
display:block
}
或简写如下:
header {
background: #fff url("/img/header-bg.jpg") repeat-x;
width: 100%;
height: 105px;
position: relative;
display:block
}将background
属性更改为background color
或将其删除background
是一个简写css属性,它将覆盖以前的所有其他样式。请交换背景图像
和背景
的顺序,或者不使用背景
,使用background color
@MuhammadUsman既然你已经解释了我做错了什么,你能把它写下来作为回答吗将background
属性更改为background color
或删除它background
是一个简写css属性,它将覆盖以前的所有其他样式。请交换背景图像
和背景
的顺序,或者不使用背景
,使用背景色既然你解释了我做错了什么,你能写下来作为回答吗?或者你可以使用背景色欢迎,如果你觉得上面给出的答案是正确的,打勾。既然穆罕默德·乌斯曼解释了我做错了什么,我给了他正确的答案,我想他以前也发过。但是你的答案也是正确的。或者你可以使用背景色Welcome,如果你觉得上面给出的答案是正确的,打个勾。因为穆罕默德·乌斯曼解释了我做错了什么,我给了他正确的答案,我想他以前也发过。但是你的也是正确的。