【发布时间】:2018-07-23 11:16:50
【问题描述】:
我有一个简单的复选框切换,可以在单击或选中时更改背景颜色,指示是否处于活动状态。我的问题是我不知道如何在那个按钮上贴标签。
类似的东西。
我不确定这是否可能。
希望你能理解我。
谢谢
body{
background-color: #ddd;
}
.toggle {
-webkit-appearance: none;
appearance: none;
width: 65.57px;
padding: 10px;
height: 26.32px;
display: inline-block;
position: relative;
border-radius: 13px;
overflow: hidden;
line-height: 16px;
text-align: center;
font-size: 12px;
outline: none;
border: none;
cursor: pointer;
background: #E1F6FF;
transition: background-color ease 0.3s;
}
.toggle:before {
content: "text text";
display: block;
position: absolute;
z-index: 2;
width: 24px;
height: 24px;
background: #fff;
left: 0;
top: 0;
border-radius: 50%;
padding-top: 5px;
text-indent: -30px;
word-spacing: 37px;
color: #4D5585;
text-shadow: -1px -1px rgba(0,0,0,0.15);
white-space: nowrap;
box-shadow: 0 1px 2px rgba(0,0,0,0.2);
transition: all cubic-bezier(0.3, 1.5, 0.7, 1) 0.3s;
}
.toggle:checked {
background: #dadce8;
}
.toggle:checked:before {
left: 40px;
}
.center{
text-align: center;
}
<div class="center">
<input class="toggle" type="checkbox" />
</center>
【问题讨论】:
-
你的白圈在哪里?你说的是方形复选框吗?
-
请检查sn-p先生
-
检查我的答案
-
不正确的先生
-
sn-p 先生,我没有看到任何圆圈,请详细说明您的问题,我不明白。