HTML5 微软认证中有关于 CSS3 background 速记中选择器正确顺序的问题...但我搜索,搜索...但没有找到有效的引用是什么该速记中的实际顺序优先级(如果有的话)...
the W3C recommendation on this matter在这个主题上不是很明确(至少,找不到该信息并不明显)......
是古老的 CSS2“看,我说唱”(CIRAP
)acronim 或多或少很吸引人……但即使在那里,W3C 也没有明确取消命令?!……
如果没有人知道标准,证书中的这种问题是什么意思?最后,CSS3 的正确顺序是什么?
他们的例子令人困惑...由 ex,以下让人相信顺序是 CIRAPCOS
Another example shows equivalence:
div { background: padding-box url(paper.jpg) white center } div { background-color: white; background-image: url(paper.jpg); background-repeat: repeat; background-attachment: scroll; background-position: center; background-clip: padding-box; background-origin: padding-box; background-size: auto auto }
然后规范提到:
Given a valid declaration, for each layer the shorthand first sets the corresponding layer of each of ‘background-image’, ‘background-position’, ‘background-size’, ‘background-repeat’, ‘background-origin’, ‘background-clip’ and ‘background-attachment’ to that property's initial value, then assigns any explicit values specified for this layer in the declaration. Finally ‘background-color’ is set to the specified color, if any, else set to its initial value.
所以,这就是我们如何获得 IPSROClACo
最佳答案
是明确写的:
值:
[ <bg-layer> , ]* <final-bg-layer>
地点:
<bg-layer> =
<bg-image>
|| <position> [ / <bg-size> ]?
|| <repeat-style>
|| <attachment>
|| <box>{1,2}
<final-bg-layer> =
<bg-image>
|| <position> [ / <bg-size> ]?
|| <repeat-style>
|| <attachment>
|| <box>{1,2}
|| <'background-color'>
一个例子,它给了我们IPSRABC:
background:
url("content.jpg")
left top / 200px 70px
no-repeat
scroll
content-box content-box
white;
/* or */
background-image: url("content.jpg") ;
background-position: left top;
background-size: 200px 70px;
background-repeat: no-repeat;
background-attachment: scroll;
background-clip: content-box;
background-origin: content-box;
background-color: white;
如果你想要一个助记符,这里有一个(是的,我完全愿意接受任何更好的句子!):
I pee a sir, Abby ! See ? (IPSRABC)
注意:您可以将 background-repeat
放在 background-position/background-size
之前,这会给您 IRPSABC。
关于html - CSS3中的背景速记顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19664549/