简体   繁体   中英

CSS selectors and pseudo-classes

Say for example I have the following styles:

#HorizNav ul li a.active:link { background-color: #FFF; }
#HorizNav ul li a.active:visited { background-color: #FFF; }
#HorizNav ul li a.active:active { background-color: #FFF; }
#HorizNav ul li a.active:hover { background-color: #FFF; }

If all the styles are the same, then how would I group these styles together?

Would it be like this?

#HorizNav ul li a.active:link, a.active:visited, a.active:active, a.active:hover { }

更简单

#HorizNav ul li a.active { background-color: #FFF; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM