We would like to know how to hover to add border to list item.
<!DOCTYPE html>
<html lang="en">
<head>
<style type="text/css">
ul {<!--from w ww . j a v a2 s. co m-->
padding: 0;
list-style: none;
}
ul li {
float: left;
margin: 10px;
}
ul li img {
display: block;
background: #f7f7f7;
}
ul li:hover {
border: 5px solid #333333;
overflow: hidden;
}
ul li:hover img {
margin: -5px;
}
</style>
</head>
<body>
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
<li>four</li>
</ul>
</body>
</html>
The code above is rendered as follows: