/ CSS, FRONT-END

How to change background color upon hovering a div?

Question

There is a div as below.

<div class="e">Wei Xia</div>
<a href="http://weixia.info/">weixia.info</a>

How to change the background color when I hover those two element?

Answer

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

a:hover {
    background-color: yellow;
}

By using :hover will update the background color. You can view the demo below.

Live Demo

Reference


This is the end of post