[英]the background doesn't show up
When I am using 'no-repeat' the background is working, but as soon as I change to 'no-repeat' there is no background. 当我使用'不重复'时背景正在工作,但一旦我改为'不重复'就没有背景。 I am trying to define the background in CSS.
我试图在CSS中定义背景。
body
{ font: normal 80% Arial, Helvetica, sans-serif;
color: #000;
background: #4E5869;
background-image: url(../images/bg_body.jpg) no-repeat;
}
Would appreciate your help. 非常感谢你的帮助。
Cheers 干杯
no-repeat
is a background-repeat
value, not a background-image
value... no-repeat
是background-repeat
值,而不是background-image
值...
background-image: url(...);
background-repeat: no-repeat;
OR: 要么:
background: #4E5869 url(...) no-repeat;
Why not try this: 为什么不试试这个:
body
{ font: normal 80% Arial, Helvetica, sans-serif;
color: #000;
background-color: #4E5869;
background-image: url(../images/bg_body.jpg);
background-repeat: no-repeat;
}
Now the background-color
and background-image
are served separately. 现在,
background-color
和background-image
分别提供。
When you call background
inside of it, you can call first your color
then your image-url
image-position
and background-repeat
. 当你在里面调用
background
时,你可以先调用你的color
然后调用你的image-url
image-position
和background-repeat
。 But when you call say background-image
then you call just the image-url
但是当你打电话说
background-image
时,你只需要调用image-url
body
{ font: normal 80% Arial, Helvetica, sans-serif;
color: #000;
background-color: #4E5869;
background-image: url(../images/bg_body.jpg);
background-repeat: no-repeat;
}
OR 要么
body
{ font: normal 80% Arial, Helvetica, sans-serif;
color: #000;
background: #4E5869 url(../images/bg_body.jpg) no-repeat;
}
This will work: 这将有效:
body {
font: normal 80% Arial, Helvetica, sans-serif;
color: #000;
background: #4E5869 url(../images/bg_body.jpg) no-repeat;
}
background-image
is the image, not any rules you wish to give. background-image
是图像,而不是你想要的任何规则。 You can go with your style like this: 你可以像这样使用你的风格:
body {
font: normal 80% Arial, Helvetica, sans-serif;
color: #000;
background: #4E5869;
background-image: url(../images/bg_body.jpg);
background-repeat: no-repeat;
}
Pretty much equal. 几乎相同。 Some stuff to read: http://www.w3schools.com/cssref/pr_background-repeat.asp
有些东西要读: http : //www.w3schools.com/cssref/pr_background-repeat.asp
You can't use no-repeat as part of background-image (all that accepts, is the URL to the image) 你不能使用no-repeat作为background-image的一部分(所有接受的,是图像的URL)
You need to use background-repeat : 你需要使用background-repeat :
https://developer.mozilla.org/en-US/docs/Web/CSS/background-repeat https://developer.mozilla.org/en-US/docs/Web/CSS/background-repeat
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.