Part Three: Asserting Your Importance

Before we talk about customizing elements of the layout, we should simplify our workflow a little bit. Remember in Part Two when we had to add multiple selectors to get our point across? Turns out this happened because of the CSS trait of precedence. If you have two bosses of equal rank, one telling you to keep things the way they were and the other to change everything, you’ll probably take the path of least resistance, unless you have a good reason not to.

You can be an upstart, though. You can lead the CSS to revolution. You can be important, no matter who you are, like this little floofy puppy:

importantfloof

You don’t have to be strong to be !important

In the last example, we had to say “.post.type-post” to change the background color on posts, but with “!important” we can use just one of those class selectors like so:

.post {
background-color: #701A6D !important;
}

This is a hot tip, and a shorter article than others, but there is some danger of using this trick too much. However, f you’ve tried a few selectors and few of them together and none of them are cooperating, put an !important in there and let them know you mean it, in a friendly way of course.


LL

(thanks Ryan and Dezro!)