IT技术资源整理
及综合资源分流

CSS3-鼠标经过悬停文字线框动画特效

效果如下:

当鼠标经过时字体发生的效果动画。

不啰嗦,直接贴代码实际。

Html标签

在HTML文件中,DIV中加入声明class:
 
<div class="demo">
	<div class="container">
		<div class="row pad-15">
			<div class="col-sm-3">
				<a href="#" class="link"><span>hover me</span></a>
			</div>

			<div class="col-sm-3">
				<a href="#" class="link"><span>hover me</span></a>
			</div>

			<div class="col-sm-3">
				<a href="#" class="link"><span>hover me</span></a>
			</div>

			<div class="col-sm-3">
				<a href="#" class="link"><span>hover me</span></a>
			</div>
		</div>
	</div>
</div>

直接调用CSS样式即可

CSS样式可挂至HTML文件中<head>标签内实现,也可以通过新建一个(xxx.css文件)并贴如代码实现以上的功能。

<link href=”xxx.css” rel=”stylesheet” type=”text/css”>

Style CSS:

<style type="text/css">
.demo{
	height: 300px;
	padding: 2em 0;
	background: #fff;
}
a:hover{text-decoration: none;}
.link{
   display: inline-block;
   position: relative;
}
.link span{
   display: block;
   padding: 7px 15px;
   font-size: 23px;
   color: #202020;
   letter-spacing: 1px;
   text-transform: uppercase;
   text-align: center;
   transition: all 0.5s ease 0s;
}
.link:hover span{ color: #ff5c19; }
.link:before,
.link:after,
.link span:before,
.link span:after{
   content: "";
   width: 25%;
   height: 100%;
   border-radius: 30px;
   border: 3px solid #ff5c19;
   border-left: none;
   border-right: none;
   position: absolute;
   top: 0;
   left: 0;
   opacity: 0;
   transform: scale(0.8);
   transition: all 0.3s ease 0s;
}
.link:after{ left: 25%; }
.link span:before{ left: 50%; }
.link span:after{ left: 75%; }
.link:hover:before,
.link:hover:after,
.link:hover span:before,
.link:hover span:after{
   border-radius: 0;
   opacity: 1;
   transform: scale(1);
}
.link:hover:before{ border-left: 3px solid #ff5c19; }
.link:hover span:after{ border-right: 3px solid #ff5c19; }
@media only screen and (max-width: 990px){
	.link span{ font-size: 20px; }
}
@media only screen and (max-width: 767px){
	.link{ margin-bottom: 20px; }
}
</style>
来源于互联网,版权归互联网原著作者所有:GLUMI » CSS3-鼠标经过悬停文字线框动画特效
标签:

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏