Toggle navigation
☰
Home
HTML
CSS
Scripting
Database
<!DOCTYPE html> <title>My Example</title> <!-- Place the following CSS in your <head> or stylesheet --> <style> /* This is an optional body style to provide a background for the page */ body { background-color: #f3f4f6; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif; } /* Optional: a container to center the card on the page for demonstration */ .demo-container-todo { display: flex; justify-content: center; padding: 2rem; } /* === To-do Card Styles === */ .todo-card { --todo-radius: 12px; --todo-shadow: 0 4px 10px rgba(0,0,0,0.06); --checkbox-color: #4f46e5; /* Indigo */ background-color: #ffffff; border-radius: var(--todo-radius); box-shadow: var(--todo-shadow); max-width: 450px; width: 100%; } .todo-card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid #e5e7eb; } .todo-card-title { font-size: 1.25rem; font-weight: 600; margin: 0; } .todo-card-summary { font-size: 0.9rem; color: #6b7280; margin-top: 0.25rem; } /* Task List */ .todo-list { list-style: none; padding: 0; margin: 0; } .todo-list li { padding: 1rem 1.5rem; } .todo-list li:not(:last-child) { border-bottom: 1px solid #f3f4f6; } .todo-item { display: flex; align-items: center; gap: 0.75rem; } /* Custom Checkbox Styling */ .todo-item input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border: 2px solid #d1d5db; border-radius: 6px; cursor: pointer; flex-shrink: 0; transition: background-color 0.2s ease, border-color 0.2s ease; display: grid; place-content: center; } /* The custom checkmark using a pseudo-element */ .todo-item input[type="checkbox"]::before { content: ""; width: 12px; height: 12px; transform: scale(0); transition: 120ms transform ease-in-out; box-shadow: inset 1em 1em white; /* Using a clip-path to create the checkmark shape */ clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); } .todo-item input[type="checkbox"]:checked { background-color: var(--checkbox-color); border-color: var(--checkbox-color); } .todo-item input[type="checkbox"]:checked::before { transform: scale(1); } .todo-item label { font-size: 1rem; color: #374151; cursor: pointer; } /* Strikethrough style for completed tasks */ .todo-item input[type="checkbox"]:checked + label { color: #9ca3af; text-decoration: line-through; } </style> <!-- Place the following HTML in your <body> --> <div class="demo-container-todo"> <section class="todo-card"> <header class="todo-card-header"> <h3 class="todo-card-title">Project Phoenix Launch</h3> <p class="todo-card-summary">2 of 4 tasks complete</p> </header> <ul class="todo-list"> <li> <div class="todo-item"> <input type="checkbox" id="task1" checked> <label for="task1">Finalize UI mockups for the new dashboard</label> </div> </li> <li> <div class="todo-item"> <input type="checkbox" id="task2" checked> <label for="task2">Deploy staging server for final QA testing</label> </div> </li> <li> <div class="todo-item"> <input type="checkbox" id="task3"> <label for="task3">Write the official press release</label> </div> </li> <li> <div class="todo-item"> <input type="checkbox" id="task4"> <label for="task4">Schedule the final go/no-go meeting</label> </div> </li> </ul> </section> </div>