Farrukh Javed
Farrukh Javed

Reputation: 39

CSS on hover change background colour and text colour as well

i want that when i move my mouse on menu. it will change background colour as well as it will change text colour. but my CSS only change background colour, it will not change text colour. need help please.

a:hover
{
    color: #231f20;     //for text new colour (not worked)
    background-color: #ffffff;     //for background new colour (it worked)
}

Upvotes: 0

Views: 7532

Answers (1)

M Brum
M Brum

Reputation: 21

I think I understand what you mean, the only reason why I don't think it worked was the way you tried to comment out the code, you were using // instead of /*.

Here's what I replaced it with:

a:hover
{
    color: #231f20;     /*for text new colour (not worked)*/
    background-color: #088a68;     /*for background new colour (it worked)*/
}
<a href="...">Small Example</a>
<br>
<a href="..." style="font-size: 50px">Big Example</a>

Live example: https://jsfiddle.net/yn16bxsv/

Hope this helped

Upvotes: 2

Related Questions