css3按钮动画

css:

a{
    color:inherit;
    text-decoration: none;
    display: block;
}
.btn3{ 
    margin:20px;
    width:250px;
    height: 60px;
    line-height: 60px;
    font-size:16px;
    color: #666;
    text-align: center;
    border:1px solid #d0d0d0; 
    position:relative; 
    overflow:hidden;
    transition: all 0.5s;
    -moz-transition: all 0.5s;
    -webkit-transition: all 0.5s;
}
.btn3 span{ 
    position:relative; 
    z-index:1;
}
.btn3:hover{ 
    color:#fff; 
    border-color: #2ECD71;
}
.btn3 .btn-bg{ 
    position:absolute; 
    background: #2ECD71; 
    left:50%; 
    width:0; 
    top:0px; 
    bottom:0px; 
    transition: all 0.5s;
    -moz-transition: all 0.5s;
    -webkit-transition: all 0.5s; 
}
.btn3:hover .btn-bg{ 
    width:100%;
    left:0px; 
}

.btn6{ 
    margin:20px;
    width:250px;
    height: 60px;
    line-height: 60px;
    font-size:16px;
    color: #666;
    text-align: center;
    border:1px solid #d0d0d0; 
    position:relative; 
    overflow:hidden;
    -webkit-transition: border-color .3s, color .3s;
    transition: border-color .3s, color .3s;
    -webkit-transition-timing-function: cubic-bezier(.2, 1, .3, 1);
    transition-timing-function: cubic-bezier(.2, 1, .3, 1);
}
.btn6 span{ 
    position:relative; 
    z-index:1; 
}
.btn6:hover{ 
    color:#fff; 
    border-color:#9A59B5;
}
.btn6 .btn-bg{
    background:#9A59B5; 
    position:absolute;
    top: 0;
    left: 0;
    width: 150%;
    height: 100%;
    z-index: -1; 
    opacity:0;
    -webkit-transform: rotate3d(0, 0, 1, -45deg) translate3d(0, -3em, 0);
    transform: rotate3d(0, 0, 1, -45deg) translate3d(0, -3em, 0);
    -webkit-transform-origin: 0% 100%;transform-origin: 0% 100%;
    -webkit-transition: -webkit-transform .3s, opacity .3s;
    transition: transform .3s, opacity .3s;
}
.btn6:hover .btn-bg{
    opacity: 1;
    -webkit-transform: rotate3d(0, 0, 1, 0deg);transform: rotate3d(0, 0, 1, 0deg);
    -webkit-transition-timing-function: cubic-bezier(.2, 1, .3, 1);
    transition-timing-function: cubic-bezier(.2, 1, .3, 1);
}

.btn9{ 
    margin:20px;
    width:250px;
    height: 60px;
    line-height: 60px;
    font-size:16px;
    color: #666;
    text-align: center;
    border:1px solid #d0d0d0;
    position:relative;
    overflow: hidden;
    -webkit-transition: all .4s;
    transition: all .4s;
}
.btn9 span{ 
    position:relative; 
    z-index:1;
}
.btn9:hover{ 
    color:#fff; 
    border-color:#1CBAB8;
}
.btn9 .bg1,.btn9 .bg2,.btn9 .bg3,.btn9 .bg4{
    background:#1CBAB8; 
    position:absolute; 
    width:25%; 
    height:0;
    -webkit-transition: height .4s;
    transition: height .4s;
}
.btn9 .bg1{ 
    top:0; 
    left:0;
}
.btn9 .bg2{ 
    bottom:0; 
    left:25%;
}
.btn9 .bg3{ 
    top:0; 
    left:50%;
}
.btn9 .bg4{ 
    bottom:0; 
    left:75%;
}
.btn9:hover .bg1,.btn9:hover .bg2,.btn9:hover .bg3,.btn9:hover .bg4{ 
    height:100%;
}

.btn11{ 
    margin:20px;
    width:250px;
    height: 60px;
    line-height: 60px;
    font-size:16px;
    color: #666;
    text-align: center;
    border:1px solid #d0d0d0; 
    position:relative; 
    overflow: hidden; 
    -webkit-transition: all .6s;
    transition: all .6s;
}
.btn11 span{ 
    position:relative; z-index:1;
}
.btn11:hover{ 
    color:#fff; 
    border-color:#5384B1;
}
.btn11 .bg1{
    content: '';
    width: 0;
    height: 0;
    -webkit-transform: rotate(360deg); 
    transform: rotate(360deg);
    border-style: solid;
    border-width: 0; 
    border-top-color:transparent;
    border-right-color:transparent;
    border-bottom-color:transparent; 
    border-left-color:#5384B1;
    position: absolute;
    bottom: 0;
    left: 0; 
    -webkit-transition: all 0.6s; 
    transition: all 0.6s;
}
.btn11 .bg2{
    content: '';
    width: 0;
    height: 0;
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
    border-style: solid;
    border-width: 0; 
    border-left-color:transparent;
    border-right-color:transparent;
    border-bottom-color:transparent;
    border-top-color:#5384B1; 
    position: absolute;
    top: 0; 
    left: 0;
    -webkit-transition: all 0.6s; 
    transition: all 0.6s;
}
.btn11 .bg3{
    content: '';
    width: 0;
    height: 0;
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
    border-style: solid;
    border-width: 0; 
    border-left-color:transparent;
    border-top-color:transparent;
    border-bottom-color:transparent;
    border-right-color:#5384B1; 
    position: absolute;
    top: 0; 
    right: 0;
    -webkit-transition: all 0.6s; 
    transition: all 0.6s;
}
.btn11 .bg4{
    content: '';
    width: 0;
    height: 0;
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
    border-style: solid;
    border-width: 0; 
    border-left-color:transparent;
    border-right-color:transparent;
    border-top-color:transparent; 
    border-bottom-color:#5384B1;
    position: absolute;
    bottom: 0; 
    right: 0;
    -webkit-transition: all 0.6s; 
    transition: all 0.6s;
}
.btn11:hover .bg1{ 
    border-width:200px 0 0 200px;
}
.btn11:hover .bg2{ 
    border-width:200px 200px 0 0;
}
.btn11:hover .bg3{ 
    border-width:0 200px 200px 0;
}
.btn11:hover .bg4{ 
    border-width:0 0 200px 200px;
}
.btn13{ 
    margin:20px;
    width:250px;
    height: 60px;
    line-height: 60px;
    font-size:16px;
    color: #666;
    text-align: center;
    border:1px solid #d0d0d0; 
    position:relative; 
    overflow: hidden; 
    -webkit-transition: all .6s;
    transition: all .6s;
}
.btn13 span{ 
    position:relative; 
    z-index:1;
}
.btn13:hover{ 
    color:#fff; 
    border-color:#FF9900;
}
.btn13 .bg1{
    content: '';
    width: 0;
    height: 0;
    -webkit-transform: rotate(360deg); 
    transform: rotate(360deg);
    border-style: solid;
    border-width: 0; 
    border-top-color:transparent;
    border-right-color:transparent;
    border-bottom-color:transparent; 
    border-left-color:#FF9900;
    position: absolute;
    bottom: 0;
    left: 0; 
    -webkit-transition: all 0.6s; 
    transition: all 0.6s;
}
.btn13 .bg2{
    content: '';
    width: 0;
    height: 0;
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
    border-style: solid;
    border-width: 0; 
    border-top-color:transparent;
    border-left-color:transparent;
    border-bottom-color:transparent; 
    border-right-color:#FF9900;
    position: absolute;
    top: 0;
    right: 0;
    -webkit-transition: all 0.6s; 
    transition: all 0.6s;
}
.btn13:hover .bg1{ 
    border-width:50px 320px;
}
.btn13:hover .bg2{ 
    border-width:50px 320px;
}

.btn14{ 
    margin:20px;
    width:250px;
    height: 60px;
    line-height: 60px;
    font-size:16px;
    color: #666;
    text-align: center;
    border:1px solid #d0d0d0; 
    position:relative; 
    overflow: hidden; 
    -webkit-transition: all .6s;
    transition: all .6s;
}
.btn14 span{ 
    position:relative; 
    z-index:1;
}
.btn14:hover{ 
    color:#fff; 
    border-color:#FF6600;
}
.btn14 .bg1,.btn14 .bg2,.btn14 .bg3,.btn14 .bg4{
    background:#FF6600;
    position: absolute;
    top:0; 
    width: 0px;
    height: 100%;
    -webkit-transition: all 0.4s; 
    transition: all 0.4s; 
    opacity:0.35;
}
.btn14 .bg3,.btn14 .bg4{ 
    opacity:0.75;
}
.btn14 .bg1,.btn14 .bg4{ 
    left:0;
}
.btn14 .bg2,.btn14 .bg3{ 
    right:0
}
.btn14:hover .bg1,.btn14:hover .bg2,.btn14:hover .bg3,.btn14:hover .bg4{ 
    width:100%;
}
.btn14:hover .bg3,.btn14:hover .bg4{
    -webkit-transition-delay:.4s;
    transition-delay:.4s;
}

html:

<div class="btn3">
    <a href="#">
        <span class="btn-inner">查看更多</span> 
        <div class="btn-bg"></div>
    </a>
</div>

<div class="btn6">
    <a href="#">
        <span class="btn-inner">查看更多</span>
        <div class="btn-bg"></div>
    </a>
</div>

<div class="btn9">
    <a href="#">
        <span class="btn-inner">查看更多</span>
        <div class="bg1"></div>
        <div class="bg2"></div>
        <div class="bg3"></div>
        <div class="bg4"></div>
    </a>
</div>

<div class="btn11">
    <a href="#">
        <span class="btn-inner">查看更多</span>
        <div class="bg1"></div>
        <div class="bg2"></div>
        <div class="bg3"></div>
        <div class="bg4"></div>
    </a>
</div>

<div class="btn13">
    <a href="#">
        <span class="btn-inner">查看更多</span>
        <div class="bg1"></div>
        <div class="bg2"></div>
    </a>
</div>

<div class="btn14">
    <a href="#">
        <span class="btn-inner">查看更多</span>
        <div class="bg1"></div>
        <div class="bg2"></div>
        <div class="bg3"></div>
        <div class="bg4"></div>
    </a>
</div>

 

posted @ 2020-10-27 10:11  可不可以重名  阅读(117)  评论(0)    收藏  举报