aja*_*221 1 css background shorthand
如果我有:
background:#A2A2A2 url('./images/img.png') repeat-x left bottom;
Run Code Online (Sandbox Code Playgroud)
然后我用:
background:#000000; /* not to confuse with 'background-color' */
Run Code Online (Sandbox Code Playgroud)
做background-image,background-repeat并且background-position迷路了吗?
background-image,background-repeat 以及 background-position(除其他事项外)将被隐当你在速记财产留给他们出去设置为默认值.这就是速记属性的工作原理(大部分).
计算出的背景样式最终看起来像这样:
background-color: #000000; /* Your specified value */
background-image: none; /* Default value */
background-repeat: repeat; /* Default value */
background-position: 0% 0%; /* Default value */
Run Code Online (Sandbox Code Playgroud)
所以,是的,你在第一个速记声明中设置的那些值将会丢失.