分享:CSS3用transition实现边框动画效果
2017-08-24 13:48
609 查看
废话不多说,直接上代码:
1:css
.animate{transition: all 0.5s ease-in-out;}
.m{width: 200px;height: 50px;text-align: center;font-size: 20px;line-height: 50px;font-family: Microsoft Yahei; color: gray;border:2px solid #dfdfdf;cursor: pointer;}
.b{position: relative;}
.b span{display: inline-block;position: absolute;content: none;border: 0;width: 0;height: 0;}
.b span.top{right:0;top:0;border-top:2px solid #000;margin-top:-2px;}
.b:hover span.top{width:198px;}
.b span.right{right:0;bottom:0;border-right:2px solid #000;margin-right:-2px;}
.b:hover span.right{height:48px;}
.b span.bottom{left:0;bottom:0;border-bottom:2px solid #000;margin-bottom:-2px;}
.b:hover span.bottom{width:198px;}
.b span.left{left:0;top:0;border-left:2px solid #000;margin-left:-2px;}
.b:hover span.left{height:48px;}
2:HTML
<div class="m b">
ABOUT US
<span class="top animate"></span>
<span class="right animate"></span>
<span class="bottom animate"></span>
<span class="left animate"></span>
</div>
</div>
1:css
code:
/*** css code ***/.animate{transition: all 0.5s ease-in-out;}
.m{width: 200px;height: 50px;text-align: center;font-size: 20px;line-height: 50px;font-family: Microsoft Yahei; color: gray;border:2px solid #dfdfdf;cursor: pointer;}
.b{position: relative;}
.b span{display: inline-block;position: absolute;content: none;border: 0;width: 0;height: 0;}
.b span.top{right:0;top:0;border-top:2px solid #000;margin-top:-2px;}
.b:hover span.top{width:198px;}
.b span.right{right:0;bottom:0;border-right:2px solid #000;margin-right:-2px;}
.b:hover span.right{height:48px;}
.b span.bottom{left:0;bottom:0;border-bottom:2px solid #000;margin-bottom:-2px;}
.b:hover span.bottom{width:198px;}
.b span.left{left:0;top:0;border-left:2px solid #000;margin-left:-2px;}
.b:hover span.left{height:48px;}
2:HTML
code:
<div style="width: 90%;height: 100px;"><div class="m b">
ABOUT US
<span class="top animate"></span>
<span class="right animate"></span>
<span class="bottom animate"></span>
<span class="left animate"></span>
</div>
</div>
相关文章推荐
- CSS3用transition实现边框动画效果
- CSS3动画:流彩文字效果+图片模糊效果+边框伸展效果实现
- 如何使用CSS3的transition实现动画效果?
- css3_实现动画设置其过渡过程中的效果_transition
- CSS3 transition实现超酷图片墙动画效果
- CSS3边框旋转动画实现效果
- CSS3 transition实现超酷图片墙动画效果
- CSS3 transition实现超酷图片墙动画效果
- Html5的CSS3的transition实现简单动画效果
- CSS3 transition实现超酷图片墙动画效果
- css3 transition属性实现3d动画效果
- CSS3 transition实现超酷动画效果
- 分享Css3设计---纯Css实现超酷的iphone玻璃气泡效果
- CSS3点击按钮实现背景渐变动画效果
- css3实现波纹式动画,点击聚焦时设置内阴影实现按钮点击立体效果
- 基于OO的动画附加插件,可以实现弹跳、渐隐等动画效果 分享
- html+css3太阳系行星运转动画效果的实现代码
- CSS3 transition介绍 | 如何设计炫酷的动画效果?
- 分享一个CSS3实现的动态内容标签页切换效果教程
- 用css3动画来实现物体上下跳动的效果