这可能是一个愚蠢的问题,但我试图将静态背景图像设置到我的网站正文,但我不想重复图像。我有这个:
body{
background:url(../assessts/BG.png) center bottom no-repeat,#000;
background-size:100% auto;
}
根本没有显示图像,但是如果我删除了不重复:
body{
background:url(../assessts/BG.png) center bottom,#000;
background-size:100% auto;
}
这显示图像正常。无论如何,图像非常大,并且在没有无重复选项的情况下可以很好地填充我的19英寸屏幕。但作为非常大屏幕的故障保护,我希望图像不要重复。
我更困惑的是我后来在CSS中使用类似方法的div:
.head{
position:absolute;
z-index:1;
top:0px;
background:url(../assessts/logo.png) center -60px no-repeat,#000;
background-size:300px auto;
width:100%;
height:200px;
display:block;
box-shadow:0px 4px 4px #000;
-moz-box-shadow:0px 4px 2px #000;
-webkit-box-shadow:0px 4px 2px #000;
}
但这没有错误。如果我没有误会它是一样的吗?
答案 0 :(得分:0)
您是否尝试重新排列属性的顺序,即background: #000 url(../assessts/BG.png) no-repeat center bottom;
在简写属性订单上查看W3C notes。