Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make a DIV cursor and background color change if I hover over it?

Tags:

html

css

I have this HTML code:

<div class="authTabs">
   <div class="h2">Login</div>
   <div class="h2">Register</div>
</div>

I am using CSS. Can someone tell me how I can make it so that my cursor changes to a finger pointing and my background color changes when the Login or Register DIVs are hovered over?


2 Answers

See DEMO

.authTabs {
 cursor: pointer;
}

.h2:hover {
background-color: red;
}
like image 125
Manwal Avatar answered Aug 13 '26 02:08

Manwal


Add this to your css definitions:

.h2:hover {
   cursor: pointer;
    background-color: red;
 }
like image 39
link64 Avatar answered Aug 13 '26 04:08

link64