CSS3链接<a>鼠标悬浮动画效果

快乐打工仔 分类:实例代码

CSS3链接<a>鼠标悬浮动画效果属于前端实例代码,有关更多实例代码大家可以查看

本章节分享一段代码实例,它实现了鼠标悬浮链接<a>之上实现动画效果。

代码实例如下:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="http://www.pipipi.net/" />
<title>前端教程网</title>
<style type="text/css">
*{
  padding:0;
  margin:0;
}
.button{
  position: relative;
  color: #cf9d68;
  border: 1px solid #cf9d68;
        padding: 1em 1.5333333333em;
  transition: color .65s cubic-bezier(1,0,0,1);
        top: 3em;
  text-decoration:none;
  margin:50px;
}
.button__text{
  position: relative;
        z-index: 2;
}
.button::before{
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  background: #cf9d68;
  -webkit-transition: width .65s cubic-bezier(1,0,0,1);
  transition: width .65s cubic-bezier(1,0,0,1);
}
 .button:hover {
        color:#FFF
}
.button:hover:before {
        width:100%
}
</style>
</head>
<body>
<a href="" class="button"><span class="button__text">前端教程网</span></a>
</body>
</html>

上面的代码实现了我们的要求,更多内容可以参阅相关内容。

相关阅读:

(1).transition可以参阅CSS3 transition一章节。

(2).::before可以参阅CSS E:before/E::before一章节。

CSS3链接<a>鼠标悬浮动画效果,这样的场景在实际项目中还是用的比较多的,关于CSS3链接<a>鼠标悬浮动画效果就介绍到这了。

回复

我来回复
  • 暂无回复内容