如何在带有url的背景的简写属性中使用“background-size:contains”。

时间:2015-08-31 09:55:04

标签: css

下面的css正在使用包含,因为它单独给出为 background-size ,但不是使用背景中给出的速记

即使我也非常想知道CSS中背景属性的参数'序列

body { 
    background: #00ff00 url("smiley.gif") no-repeat fixed center;
    background-size:contain,contain; 
}

 body { 
    background: #00ff00 url("smiley.gif") no-repeat contain,contain fixed center; 
}  

but this is not working as i tried this shorthand method as above 
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>
<p>This is some text</p>

单独使用没有问题,但需要知道是否有任何方式在速记背景属性中使用 background-size:contains

即使你可以通过在W3School的例子中进行更改来检查它,这里是它的网址

click to check your way

1 个答案:

答案 0 :(得分:2)

background: #00ff00 url("smiley.gif") no-repeat fixed center / contain; 

这应该有效。