Thursday, April 19, 2018

:nth-child(1n+0) instead of !important

Styling a tag more specific than the one you want to overpower instead of merely using the !important hack is probably a better way to get around a style blockade. There is a whole numeric scoring system for who wins in CSS collisions beyond merely inline styles beating ids and ids beating classes, and the more specific stylings beat those that are less so. By the way the an+b specification will style every Ath child starting at position b so in this case, every child.

 
 

Addendum 4/20/2018: This has some notes on the grading for the specificity rules.

No comments:

Post a Comment