Archive for selector

You are browsing the archives of selector.

How to Count CSS Specificity Scores and Leverage !Important Overrides

photo credit: laffy4k
If you are having difficulty getting a particular CSS style to “appear”, one thing to check is your specificity. CSS specificity is a four digit score for resolving cascade conflicts. You can actually add up the specificity score to determine which conflicting style should prevail. The four digit score is comprised of [...]

Space is Critical in CSS Selectors

photo credit: makelessnoise
If you are having difficulty getting a particular CSS style to “appear”, one thing to look at is your selector. A tiny space can cause two different selections if you are not careful.
For example, notice the single space difference between these two selectors:

div#navbar {
background-color: #999;
}
div #navbar {
[...]