div hover background-color change?

How can I make it act as if a line of div is anchor so when I hover on it it returns to red

CSS

.e
{ width:90px; border-right:1px solid #222; text-align:center; float:left; padding-left:2px; cursor:pointer;
}
.f .e
{ background-color:#F9EDBE;
}

HTML

<div> <div >Company</div> <div>Target</div> <div>Person</div>
</div>
<div> <div>Company</div> <div>Target</div> <div>Person</div>
</div>
<div> <div>Company</div> <div>Targetaaa</div> <div>Person</div>
</div>
<div> <div>Company</div> <div>Target</div> <div>Person</div>
</div> 
1

4 Answers

.e:hover{ background-color:#FF0000;
}

if you want the color to change when you have simply add the :hover pseudo

div.e:hover { background-color:red;
}
2

div hover background color change

Try like this:

.class_name:hover{ background-color:#FF0000;
}
<html>
<head>
<style>
.e { width:90px; border-right:1px solid #222; text-align:center; float:left; padding-left:2px; cursor:pointer;
}
e2:hover { background-color:red;
}
</style>
</head>
<body>
<div> <div >Company</div> <div>Target</div> <div>Person</div>
</div>
</body>
</html>

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like