پیشنمایش زنده
کد HTML
<div class="checklist-container">
<div class="checklist-title">Daily Task List</div>
<div class="checklist-item">
<input type="checkbox" id="tugas1" class="checklist-checkbox" />
<label for="tugas1" class="checklist-label">
Complete project A report</label
>
</div>
<div class="checklist-item">
<input type="checkbox" id="tugas2" class="checklist-checkbox" />
<label for="tugas2" class="checklist-label"
>Reply to email from client B</label
>
</div>
<div class="checklist-item">
<input type="checkbox" id="tugas3" checked="" class="checklist-checkbox" />
<label for="tugas3" class="checklist-label"
>Schedule weekly team meeting</label
>
</div>
<div class="checklist-item">
<input type="checkbox" id="tugas4" checked="" class="checklist-checkbox" />
<label for="tugas4" class="checklist-label">Buy groceries for dinner</label>
</div>
<div class="checklist-item">
<input type="checkbox" id="tugas5" class="checklist-checkbox" />
<label for="tugas5" class="checklist-label">Exercise for 30 minutes</label>
</div>
</div>
کد CSS
.checklist-container {
font-family: sans-serif;
max-width: 500px;
margin: 40px auto;
padding: 20px;
background-color: #f4f7f6;
border-radius: 8px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.checklist-title {
text-align: center;
color: #333;
margin-bottom: 25px;
font-size: 1.5em;
font-weight: bold;
}
.checklist-item {
display: flex;
align-items: center;
padding: 12px 0;
border-bottom: 1px solid #e0e0e0;
position: relative;
}
.checklist-item:last-child {
border-bottom: none;
}
.checklist-checkbox {
margin-right: 12px;
cursor: pointer;
flex-shrink: 0;
transform: scale(1.2);
accent-color: #2ecc71;
}
.checklist-label {
color: #444;
cursor: pointer;
position: relative;
transition: color 0.4s ease-in-out;
display: inline-block;
width: fit-content;
}
.checklist-label::after {
content: "";
position: absolute;
top: 50%;
left: 0;
width: 100%;
height: 2px;
background-color: #e74c3c;
transform: scaleX(0);
transform-origin: left;
transition: transform 0.4s ease-out;
}
.checklist-checkbox:checked + .checklist-label {
color: #aaa;
}
.checklist-checkbox:checked + .checklist-label::after {
transform: scaleX(1);
}