这个button有点意思-css(4)

主要知识点:

transition
box-shadow

利用时间差完成描边的过程,样式可能有点丑,shadow不是重点…主要是学习用法

效果图片
btn.png
html文件
 <div class="a-box">
        <a href="">button</a>
 </div>  
css文件
   .a-box{
        text-align:center;
    }
    a{
        display: inline-block;
        margin: 10px 0;
        padding: 25px 50px;
        font-size: 20px;
        line-height: 0;
        color: #666;
        text-transform: uppercase;
        letter-spacing: 1px;
        text-decoration: none;
        font-weight: 700;
        transition: box-shadow ease-in 1s;
        box-shadow: 0 3px 3px -3px #ccc,0 2px 2px -2px rgba(255,255,255,.6),0 1px 1px -1px rgba(255,255,255,.8);
        overflow: hidden;
        position: relative;
        cursor: pointer;

    }
    a:before, a:after{
        box-sizing: border-box;
        border: 1px solid transparent;
        width: 0;
        height: 0;
        content: '';
        display: block;
        position: absolute;
    }
    a:after{
         bottom: 0;
         left: 0;
         -webkit-transition: border-color 0s ease-in .8s,height .2s ease-in .6s,width .2s ease-in .4s;
         transition: border-color 0s ease-in .8s,height .2s ease-in .6s,width .2s ease-in .4s;
     }
    a:before{
         top: 0;
         right: 0;
         -webkit-transition: border-color 0s ease-in .4s,height .2s ease-in .2s,width .2s ease-in;
         transition: border-color 0s ease-in .4s,height .2s ease-in .2s,width .2s ease-in;
     }
    a:hover{
        color: #638aba;
        box-shadow: 0 3px 3px  #ccc,0 2px 2px  rgba(255,255,255,.6),0 1px 1px rgba(255,255,255,.8);
    }
    a:hover:after{
         width: 100%;
         height: 100%;
         border-top-color: #638aba;
         border-left-color: #638aba;
         -webkit-transition: height .3s ease-out,width .3s ease-out .3s;
         transition: height .3s ease-out,width .3s ease-out .3s;
     }
    a:hover:before{
         width: 100%;
         height: 100%;
         border-bottom-color: #638aba;
         border-right-color: #638aba;
         -webkit-transition: border-color 0s ease-out .6s,height .3s ease-out .6s,width .3s ease-out .9s;
         transition: border-color 0s ease-out .6s,height .3s ease-out .6s,width .3s ease-out .9s;
     }

demo 请在chrome下预览(未写兼容性)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 174,167评论 25 709
  • Alphago对战柯洁,没有上次对战李世石那么引人注意,因为每个人都清楚,包括柯洁自己,人脑对电脑的战争,是场没有...
    钱公公阅读 181评论 0 0
  • 一、新模式,构筑立体传播体系 1、统一品牌造声势 1)主题明确,定位准确:以“上10086.cn,享智能便捷生活”...
    豪研阅读 490评论 0 2
  • 前言 具体的详细介绍在这里就不说了,为方便使用,这里记录一些简单常用的语法。放上详细链接,有需要的可以学习。Mar...
    爱偷懒的万万阅读 473评论 7 8
  • 昨晚超级丹跟李宗伟的第37次对战,已拉下谢幕,林丹虽然以两分之差惜败对手,但仍是我们大家心目中的冠军,带给喜欢他的...
    圆圆的湘气阅读 398评论 6 2