It doesnβt matter which order the classes are listed in the HTML element.
<style>
body {
background-color: black;
font-family: monospace;
color: green;
}
.pink-text {
color: pink;
}
.blue-text {
color: blue;
}
</style>
<h1 class="blue-text pink-text">Hello World!</h1>
However, the order of the class
declarations in the <style>
section is what is important. The second declaration will always take precedence over the first. Because .blue-text
is declared second, it overrides the attributes of .pink-text