|
Sunday, July 7th, 2024
Dots icons
ラベル要素とインプット要素を使用してアイコンを実装します。
ご自由にご利用ください。
Previews
Examples html
<!-- icons -->
<div class="icons">
<input type="checkbox" name="checkbox" id="checkbox" />
<label for="checkbox" class="label">
<span class="item item1"></span>
<span class="item item2"></span>
<span class="item item3"></span>
</label>
</div>
<!-- /icons -->
Examples css
/* - icons - */
.icons {
position: relative;
width: 25px;
height: 25px;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
background-color: rgba(0, 0, 0, 0.0);
}
input[type="checkbox"] {
display: none;
}
label.label {
display: block;
position: absolute;
top: 0px;
left: 0px;
width: 25px;
height: 25px;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
background-color: rgba(0, 0, 0, 0.0);
cursor: pointer;
transition: all .5s;
}
label.label span.item {
display: block;
position: absolute;
width: 5px;
height: 5px;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
background-color: rgba(0, 0, 0, 1.0);
border-radius: 50%;
transition: all .5s;
}
label.label span.item1 {
transform: translate(10px, 0px);
}
label.label span.item2 {
transform: translate(10px, 10px);
}
label.label span.item3 {
transform: translate(10px, 20px);
}
label.label:hover span {
background-color: rgba(192, 192, 192, 1.0);
}
label.label:active span {
background-color: rgba(0, 0, 0, 1.0);
}
input[type="checkbox"]:checked ~ label.label {
transform: rotate(90deg);
}
/* - /icons - */
Summary
最後までご高覧いただきましてありがとうございました。
ラベル要素とインプット要素を使用して実装するアイコンをご紹介させていただきました。
必要に応じて各コードを変更してご自由にご利用ください。
現場からは以上でした。