I need to change the color of the icons next to the main menu list items. They are currently blue (#0282ca) and I need them to change to white on the hover state or when they are the currently selected menu item.
I believe the problem is that I had to add the “!important” rule to get these icons to turn blue in the first place.
So the answer is in why you had to resort to using !important.
The element has in-line styling telling it to be white. In-line styles are hard to override, only important will do it. The best thing is to just not have in-line styles, assuming you are able to edit the html.
The next problem is the element has another css selector telling it to be white and that selector includes an id which will also be difficult to override due the the huge specificity weight of IDs in selectors.
I don’t believe I will have the ability to directly remove the inline style. It is written using part of a WordPress theme. I will look in the PHP to see if it would be easy to locate…
Looks like a good answer from @Erik_J there but it may be worth considering using a Child Theme in the future, if you not familiar with a child theme then this normally contains just a few files like your style.css and your functions.php in some cases, your logo perhaps also… Doing this will mean you never mess about with your core theme files, some themes bundle a child theme with the main theme so you never actually touch the originals… I should point out also that many themes have an area where you can insert what’s called Custom CSS, this works in the same sort of way…
@Erik_J This kind of works. Now when I hover anywhere over the entire main menu, all of the icons turn white. Even the ones without the orange background. Take a look…