📅  最后修改于: 2021-01-06 04:41:48             🧑  作者: Mango
在Less中,父选择器由&(&)运算符。嵌套规则的父选择器由&运算符表示,在将修改类或伪类应用于现有选择器时最常用。
指定父选择器类型的列表:
Index | Types | Description |
---|---|---|
1) | Multiple & | The & is used to represent nearest selector and also all the parent selectors. |
2) | Changing Selector Order | It is used to change the selector order because prepending a selector to the inherited (parent) selectors is useful when selector ordering is changed. |
3) | Combinatorial Explosion | The & operator can also produce all the possible permutation of selectors in a list. The selectors in the list are separated by commas. |
让我们以一个示例来演示父选择器的用法。
创建一个名为“ simple.html”的HTML文件,其中包含以下数据。
HTML档案:simple.html