Multiple Pseudo Classes on a Single Selector

对着背影说爱祢 提交于 2021-01-27 18:49:51

问题


Is the following CSS syntax valid?

a:first-child:hover { background-color: transparent; }

If so, what is the compatibility as far as browsers? For example, is it compatible in IE8, IE6+, Firefox 4, Chrome, etc.


回答1:


Combo first-child and :hover is correct(IE6 recognize only last pseudo-class in the chain):

div span:first-child:hover {
  color: red;
}
<div>
  <span>asdasd</span>
  <span>asdasd</span>
  <span>asdasd</span>
</div>


来源:https://stackoverflow.com/questions/27331619/multiple-pseudo-classes-on-a-single-selector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!