css3炫酷边框动画

先看布局:

 
//盒子左上角动画 //盒子右下角动画

再看css:

.img-wrap {
    float: left;
    margin-right: 26px;
    width: 240px;
    height: 135px;
    overflow: hidden;
    position: relative;
}
 .img-wrap .l_t,  .img-wrap .r_b {
    position: absolute;
    z-index: 9;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border: 3px solid transparent;
    -webkit-transition: width 0.6s ease-in-out,height 0.6s ease-in-out;
    -moz-transition: width 0.6s ease-in-out,height 0.6s ease-in-out;
    -o-transition: width 0.6s ease-in-out,height 0.6s ease-in-out;
    -ms-transition: width 0.6s ease-in-out,height 0.6s ease;
    transition: width 0.6s ease-in-out,height 0.6s ease-in-out;
}
.img-wrap:hover .l_t,
.img-wrap:hover .r_b{
    width:100%;
    height:100%;
    box-sizing:border-box;
}
.img-wrap:hover .l_t{
    border-top-color: #da9f20;
    border-left-color: #da9f20;
}
.img-wrap:hover .r_b{
    top:auto;
    left:auto;
    right:0;
    bottom:0;
    border-bottom-color: #da9f20;
    border-right-color: #da9f20;
}

你可能感兴趣的:(css3炫酷边框动画)