【发布时间】:2019-01-18 10:01:03
【问题描述】:
我继承了一些 CSS 代码,它使用 id 名称之前的 & 字符来设置它的样式。它看起来像这样:
&#my-id {
// Content and attributes
}
还有其他的例子,比如:
&:before {
// content and attributes
}
和
&:hover {
// content and attributes
}
这些是什么意思?我在搜索中找不到表达这一点的好方法,所以我找不到任何东西。如果这是重复的,我深表歉意。
【问题讨论】:
-
注意它们在其他选择器块中的位置。例如。
#something { color:red; &:hover { color:blue; } }- 这应该给你一个线索。编译后得到#something {color:red} #something:hover {color:blue}