We would like to know how to animate bottom border when hover.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.active {<!-- w ww . j a v a2 s.com-->
position: relative;
color: #000;
text-decoration: none;
}
.link:hover {
color: red;
}
.link:before {
content: "";
position: absolute;
width: 100%;
height: 2px;
bottom: 0;
left: 0;
background-color: #000;
visibility: hidden;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transition: all 0.3s ease-in-out 0s;
transition: all 0.3s ease-in-out 0s;
}
.link:hover:before {
visibility: visible;
-webkit-transform: scaleX(1);
transform: scaleX(1);
}
.permalink:before {
content: "";
position: absolute;
width: 100%;
height: 2px;
bottom: 0;
left: 0;
background-color: #000;
visibility: visible;
-webkit-transform: scaleX(1);
transform: scaleX(1);
}
</style>
</head>
<body>
<a href="http://java2s.com" class="underlined-example active link">Hover this link</a>
</body>
</html>
The code above is rendered as follows: