Background color when cursor hovers over text
-
I’m new to CSS, trying to add code to give my main menu text a background color when the cursor hovers over it but it’s not quite working how I have it.
.main-navigation ul li:active{
background-color: #FF0000;
}Penscratch theme for nicholasciccone.com
The blog I need help with is: (visible only to logged in users)
-
You almost got it right :-)
Modify your style to the following and see if you got the requires effect:
.main-navigation ul li a:hover { background-color: red } -
Awesome, that worked! Now, I’m trying to use that same code to change the font color of that menu, when hovering over, by just changing “background-color” to “font-color,” but that doesn’t seem to work.
(trying to make the background a solid color and the text white)
What am I missing?
-
Font color attribute is just color. So add the following rule to the earlier CSS:
color: #fff;The complete CSS is:
.main-navigation ul li a:hover { background-color: #190707; color: #fff; } -
- The topic ‘Background color when cursor hovers over text’ is closed to new replies.