css specificity help

Slapshot136

Divide et impera
Reaction score
471
I have a website where I used a and a:hover to set the color for my links to white/light grey, but I want the links to be dark in my navbar, where I have it formatted using #header_nav_button id's - I have been trying all sorts of ways to re-arrange a and #header_nav_button, but I can't seem to override the while/light grey colors from the general a
 

UndeadDragon

Super Moderator
Reaction score
447
You can overwrite a CSS rule using !important. An example of this in your situation would be:

a { color: #fff; }
a:hover { color: #eee; }

#nav a { color: #c00 !important; }
#nav a:hover { color: #a00 !important; }
 

Slapshot136

Divide et impera
Reaction score
471
You can overwrite a CSS rule using !important. An example of this in your situation would be:

a { color: #fff; }
a:hover { color: #eee; }

#nav a { color: #c00 !important; }
#nav a:hover { color: #a00 !important; }

thanks for the help, I didn't realize that #nav a:hover was the format that I needed to combine the two

I didn't need to use the !important because a specified id is already more important then any entire page rules
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top