728x90
체크박스 디자인 1
기본 체크박스로 활용할 수 있다.
✔️ HTML
<div class="cbxBox">
<input checked="" type="checkbox" id="cb1">
<label for="cb1" class="cbx"></label>
</div>
✔️ CSS
.cbxBox {
position: relative;
}
.cbxBox .cbx {
position: relative;
display: block;
width: 25px;
height: 25px;
border: 1px solid #a1a1a1;
border-radius: 5px;
cursor: pointer;
transition: all 0.3s ease;
}
.cbxBox .cbx:after {
content: '';
position: absolute;
top: 2px;
left: 10px;
width: 5px;
height: 14px;
opacity: 0;
transform: rotate(45deg) scale(0);
border-right: 2px solid #fff;
border-bottom: 2px solid #fff;
transition: all 0.3s ease;
}
.cbxBox input[type=checkbox] {
display: none !important;
}
.cbxBox input[type=checkbox]:checked ~ .cbx {
border-color: transparent;
background: #392ca7;
animation: anima 0.6s ease;
}
.cbxBox input[type=checkbox]:checked ~ .cbx:after {
opacity: 1;
transform: rotate(45deg) scale(1);
}
@keyframes anima {
from {
transform: scale(1, 1);
}
25% {
transform: scale(0.95, 0.95);
}
50% {
transform: scale(1.15, 1.15);
}
75% {
transform: scale(0.95, 0.95);
}
to {
transform: scale(1, 1);
}
}
✔️ GitHub
반응형
'개발 > UI' 카테고리의 다른 글
체크박스 디자인-2 (checkbox Design-2 with CSS) (10) | 2023.05.21 |
---|---|
스위치 디자인-1 (Switch Design-1 with CSS) (1) | 2023.05.02 |
알림 디자인-1 (notification Design-1 with CSS) (2) | 2023.05.02 |
버튼 디자인-2 (button Design-2 with CSS) (1) | 2023.04.27 |
버튼 디자인-1 (button Design-1 with CSS) (1) | 2023.04.26 |
댓글