html 边框效果,纯css实现边框效果(原创)

.box {

width:100px;

height:100px;

border:1px solid #eee;

position:relative;

margin:50px auto;

background-color:rgb(173,151,173);

}

.box1 {

width:100px;

height:100px;

border:1px solid #eee;

position:relative;

margin:50px auto;

background-color:rgb(100,112,106);

}

.box2 {

width:100px;

height:100px;

border:1px solid #eee;

position:relative;

margin:50px auto;

background-color:rgb(208,215,233);

}

.left-to-right-border {

position:absolute;

width:0;

height:1px;

background-color:rgba(98,194,60,0.8);

top:0;

left:0;

bottom:0;

transition:0.5s;

-webkit-transition:0.5s;

-moz-transition:0.5s;

-ms-transition:0.5s;

-o-transition:0.5s;

-webkit-box-shadow:0px -3px 5px rgb(81,221,25);

box-shadow:0px -3px 5px rgb(70,219,11);

}

.right-to-bottom-border {

position:absolute;

width:1px;

height:0px;

background-color:rgba(98,194,60,0.8);

top:0;

right:0;

transition:0.5s;

-webkit-transition:0.5s;

-moz-transition:0.5s;

-ms-transition:0.5s;

-o-transition:0.5s;

-webkit-box-shadow:3px 0px 5px rgb(81,248,15);

box-shadow:3px 0px 5px rgb(71,233,8);

}

.bottom-to-left-border {

position:absolute;

width:0px;

height:1px;

background-color:rgba(98,194,60,0.8);

bottom:0;

right:0;

transition:0.5s;

-webkit-transition:0.5s;

-moz-transition:0.5s;

-ms-transition:0.5s;

-o-transition:0.5s;

-webkit-box-shadow:0px 3px 5px rgb(80,245,14);

box-shadow:0px 3px 5px rgb(73,226,12);

}

.bottom-to-start-border {

position:absolute;

width:1px;

height:0px;

background-color:rgba(98,194,60,0.8);

bottom:0;

left:0;

transition:0.5s;

-webkit-transition:0.5s;

-moz-transition:0.5s;

-ms-transition:0.5s;

-o-transition:0.5s;

-webkit-box-shadow:-3px 0px 5px rgb(78,241,13);

box-shadow:-3px 0px 5px rgb(74,240,8);

}

.box:hover .left-to-right-border {

width:100%;

transition:0.5s;

-webkit-transition:0.5s;

-moz-transition:0.5s;

-ms-transition:0.5s;

-o-transition:0.5s;

}

.box:hover .right-to-bottom-border {

height:100%;

transition:0.5s;

-webkit-transition:0.5s;

-moz-transition:0.5s;

-ms-transition:0.5s;

-o-transition:0.5s;

}

.box:hover .bottom-to-left-border {

width:100%;

transition:0.5s;

-webkit-transition:0.5s;

-moz-transition:0.5s;

-ms-transition:0.5s;

-o-transition:0.5s;

}

.box:hover .bottom-to-start-border {

height:100%;

transition:0.5s;

-webkit-transition:0.5s;

-moz-transition:0.5s;

-ms-transition:0.5s;

-o-transition:0.5s;

}

/* 强大的分割线 */

.box2:hover .left-to-right-border {

width:100%;

-webkit-transition-duration:0.2s;

transition-duration:0.2s;

-webkit-transition-timing-function:linear;

transition-timing-function:linear;

-webkit-transition-delay:0s;

transition-delay:0s;

}

.box2:hover .right-to-bottom-border {

height:100%;

-webkit-transition-duration:0.2s;

transition-duration:0.2s;

-webkit-transition-timing-function:linear;

transition-timing-function:linear;

-webkit-transition-delay:0.2s;

transition-delay:0.2s;

}

.box2:hover .bottom-to-left-border {

width:100%;

-webkit-transition-duration:0.2s;

transition-duration:0.2s;

-webkit-transition-timing-function:linear;

transition-timing-function:linear;

-webkit-transition-delay:0.4s;

transition-delay:0.4s;

}

.box2:hover .bottom-to-start-border {

height:100%;

-webkit-transition-duration:0.2s;

transition-duration:0.2s;

-webkit-transition-timing-function:linear;

transition-timing-function:linear;

-webkit-transition-delay:0.6s;

transition-delay:0.6s;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值