In to-do list apps, if you finish to-do the color of text changes. I'm trying to make that, but there is issue. How can I make this with only pure css?
.todo-item {
display: flex;
justify-items: space-between;
align-items: center;
gap: 10px;
}
.todo-item div {
position: relative;
}
.todo-item div input {
position: absolute;
opacity: 0;
width: 20px;
height: 20px;
z-index: 50;
}
.todo-item div {
border: 2px black solid;
border-radius: 50%;
width: 20px;
height: 20px;
display: flex;
justify-content: center;
align-items: center;
}
.todo-item div input[type=checkbox]:checked+div {
background-color: black;
}
<div class="todo-item">
<span>If checkbox is selected, color of this text need to be changed to green.</span>
<div>
<input type="checkbox">
<div>
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="white">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M5 13l4 4L19 7" />
</svg>
</div>
</div>
</div>