Question

There is a div as below.

1
2
<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

1
2
3
4
5
6
7
.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