问题
I understand that background
is the shorthand property - what will the value 0
do to all of the properties and is it valid CSS?
selector {background:0;}
回答1:
background:0
is valid css and gets compiled into:
background-image: initial;
background-position-x: 0px;
background-position-y: 50%;
background-size: initial;
background-repeat-x: initial;
background-repeat-y: initial;
background-attachment: initial;
background-origin: initial;
background-clip: initial;
background-color: initial;
回答2:
Yes, the zero will be interpreted as the horizontal background position. The other background properties are set to the default values, so you end up with the same as:
background-image: none;
background-repeat: repeat;
background-attachment: scroll;
background-position: 0 center;
background-color: transparent;
来源:https://stackoverflow.com/questions/24306770/is-background0-valid-css