Our "pink-text" class overrode our
body element's CSS declaration!
We just proved that our classes will override the
body element's CSS. So the next logical question is, what can we do to override our
Create an additional CSS class called
blue-text that gives an element the color blue. Make sure it's below your
pink-text class declaration.
blue-text class to your
h1 element in addition to your
pink-text class, and let's see which one wins.
Applying multiple class attributes to a HTML element is done with a space between them like this:
Note: It doesn't matter which order the classes are listed in the HTML element.
However, the order of the
class declarations in the
<style> section are what is important. The second declaration will always take precedence over the first. Because
.blue-text is declared second, it overrides the attributes of