background-size ,写在background里面,使用右划线

background:url(XXXXXXXXXXX) no-repeat 10px 20px /  10px 20px;


右划线后面就是 background-size 属性

等同于单写一行 background-size:10px 20px;


参考文档:


http://www.w3.org/TR/css3-background/#background-size



In the first rule of the following example, only a value for ‘background-color’ has been given and the other individual properties are set to their initial values. In the second rule, many individual properties have been specified.

body { background: red }
p { background: url("chess.png") 40% / 10em gray
       round fixed border-box; }

The first rule is equivalent to:

body {
    background-color: red;
    background-position: 0% 0%;
    background-size: auto;
    background-repeat: repeat;
    background-clip: border-box;
    background-origin: padding-box;
    background-attachment: scroll;
    background-image: none }

The second is equivalent to:

p {
    background-color: gray;
    background-position: 40% 50%;
    background-size: 10em 10em;
    background-repeat: round;
    background-clip: border-box;
    background-origin: border-box;
    background-attachment: fixed;
    background-image: url(chess.png) }

你可能感兴趣的:(CSS)