将通用选择器(*)与相邻选择器(+)一起使用 [英] Using universal selector (*) in conjunction with the adjacent selector (+)
本文介绍了将通用选择器(*)与相邻选择器(+)一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如:
* + fieldset {...}
解决方案
当 fieldset 不是
:first-child
时, 。
下面的代码片段演示了最好的用例:
$ b
* + fieldset {background:red;}
< DIV> <字段集> ...< / fieldset>< / div>< div> < p为H. ...< / p为H. <字段集> ...< / fieldset>< / div>
When is the right time to use the universal selector in combination with the adjacent selector in CSS?
For instance:
* + fieldset {...}
解决方案
This will be good when fieldset
is not the :first-child
.
The below snippet demonstrates the best use-case:
* + fieldset {
background: red;
}
<div>
<fieldset>
...
</fieldset>
</div>
<div>
<p>...</p>
<fieldset>
...
</fieldset>
</div>
这篇关于将通用选择器(*)与相邻选择器(+)一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文