!important rule

Imagine style-library.css is a stylesheet that is full of good styles! But, you don’t like how it is turning the color of <h1> yellow.

In style.css , add an !important rule to the color style of inside the h1 ruleset to change the color back to #FFF (white).
Hi! I have been trying to do this exercise, but no matter how much I erase and re-add the !important rule to the ruleset, it does not work. Should it be like this: h1{
color: yellow !important
}
or should it be placed another way? I am not sure since it is not working for me. I would really appreciate some help! Thank you!

This question is in the Important lesson of the Learn CSS course.

color: yellow !important <— needs to be closed off with a semi-colon.
color: yellow !important;

1 Like

Thank you so much! I did have a semi-colon in the end, thought it still decided not to work. I am not sure what the problem is, since I did it with the correct code formatting and everything, but thank you so much!

Screenshot 2021-12-31 9.52.12 PM
This is how my code is, I’m not sure why it is not working.

I would read the instructions again but also if its a super short exercise example. Use the reset button and start over looking at the instructions carefully.
Make sure you don’t skip instructions and first do what the instructions ask step by step.

make sure youre in the Style.css file not the style-library.css its as simple as removing the semi-colon and replacing it with !imprtant; after #FFF

I add the css directly in the html tag. For example when I use bootstrap it looks like this:

<a class="link" style="color:red!important">Home</a>
<a class="link" style="color:silver!important">Product</a>
<a class="link" >Contact</a>
<a class="link" >About</a>

The first link is in red and the second in silver. The last two inherit the css properties of the bootstrap class and are blue.

Hi, I just figured this out myself. The !important doesn’t go with the new CSS window that was introduced. If you go into the original CSS tab, and go to where the h1 section of code is, you will see the #FFF line there, remove the semi-colon and put the !important there with ending with the semi-colon. A little late to replying but hopefully this helps somebody.