You may have wondered if the order your CSS rules are written in, matters. Let’s explore to start answering that question ourselves!

Try It: Does Order Matter?

Go into one of your CodePens and try switching around the order of rules. Do you see any changes?

Now, try switching around the order of property/values within a rule. Do you see any changes?

The answer is: yes and no.

CSS stands for Cascading Style Sheets. It is read from top to bottom. In very rare cases, you will see that switching the order of rules or property/values within a rule will change the appearance of your site. For what we’re doing here at camp, it’s probably more important to be aware of the hierarchy of element ➡ class ➡ ID when targeting something to write a rule for.