پیشنمایش زنده
کد HTML
<div class="content">
<label class="checkBox">
<input type="checkbox" id="ch1" />
<div class="transition"></div>
</label>
<div class="text-desc">
<label for="ch1" class="text">
Option 1
<p class="desc">Lorem ipsum dolor</p>
</label>
</div>
</div>
کد CSS
.content {
display: flex;
align-items: center;
gap: 12px;
cursor: pointer;
}
.text-desc {
display: flex;
flex-direction: column;
}
.desc {
font-size: 10px;
color: gray;
}
.text {
color: white;
font-weight: bold;
cursor: pointer;
font-size: 14px;
}
.content:hover {
background-color: rgb(236, 232, 231, 0.1);
border-radius: 16px;
padding: 16px;
}
.checkBox {
display: block;
width: 30px;
height: 30px;
border: 3px solid rgba(255, 255, 255, 0);
border-radius: 30px;
position: relative;
box-shadow: 0px 0px 0px 2px #fff;
transition: 200ms all;
cursor: pointer;
overflow: hidden;
}
.checkBox .transition {
width: 60px;
height: 60px;
background-color: #fff;
top: -52px;
left: -52px;
position: absolute;
transform: rotateZ(45deg);
z-index: 100;
}
.checkBox input[type="checkbox"]:checked + div {
left: -10px;
top: -10px;
}
.checkBox input[type="checkbox"] {
position: absolute;
left: 50px;
visibility: hidden;
}
.transition {
transition: 300ms ease;
}