html三角形排序按钮,HTML5 三角形 | 棱形开关按钮控件

CSS

语言:

CSSSCSS

确定

body {

background-color: #6d5944;

font-family: sans-serif;

}

.toggle-container {

height: 40px;

margin: 100px auto;

width: 96px;

}

.toggle {

background-color: #b6aca2;

cursor: pointer;

height: 100%;

line-height: 0;

margin: 16px 0;

-webkit-user-select: none;

-moz-user-select: none;

-ms-user-select: none;

user-select: none;

width: 100%;

}

.toggle.active {

background-color: #ef5b30;

}

.toggle:before,

.toggle:after {

border-bottom: 20px solid transparent;

border-top: 20px solid transparent;

content: ' ';

height: 0;

position: absolute;

width: 0;

}

.toggle:before {

border-right: 19px solid #b6aca2;

margin-left: -19px;

}

.toggle:after {

border-left: 19px solid #b6aca2;

margin-left: 96px;

}

.toggle.active:before {

border-right-color: #ef5b30;

}

.toggle.active:after {

border-left-color: #ef5b30;

}

.toggle span {

line-height: 40px;

position: absolute;

text-align: center;

width: 96px;

}

.toggle .on,

.toggle.active .off {

-webkit-transition: margin 0.38s ease, color 0.19s ease;

transition: margin 0.38s ease, color 0.19s ease;

}

.toggle .off,

.toggle.active .on {

color: #fff;

margin-left: 0;

-webkit-transition: margin 0.38s ease, color 1s ease;

transition: margin 0.38s ease, color 1s ease;

}

.toggle .on {

color: transparent;

margin-left: -80px;

}

.toggle.active .off {

color: transparent;

margin-left: 80px;

}

.toggle .icon:before {

background-color: #ef5b30;

content: '';

height: 22px;

left: -8px;

position: absolute;

top: 9px;

-webkit-transform: rotate(45deg);

transform: rotate(45deg);

-webkit-transition: all 0.4s ease;

transition: all 0.4s ease;

width: 22px;

z-index: 1;

}

.toggle.active .icon:before {

background-color: #fff;

left: 81px;

}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值