Abhaken zum Auswählen
Abhaken zum Auswählen: CSS-Card. Kopiere die Regeln oder den Prompt, der das Ergebnis nachbaut.
CSS
.card-070 {
display: flex;
align-items: flex-start;
gap: 14px;
width: 320px;
padding: 16px 18px;
background: #fff;
border: 2px solid #e5e7eb;
border-radius: 14px;
font-family: system-ui,sans-serif;
color: #111827;
cursor: pointer;
transition: border-color .15s,background .15s
}
.card-070 input {
position: absolute;
opacity: 0;
width: 0;
height: 0
}
.card-070__box {
flex: none;
width: 20px;
height: 20px;
margin-top: 2px;
border: 2px solid #d1d5db;
border-radius: 6px;
display: grid;
place-items: center;
transition: background .15s,border-color .15s
}
.card-070__box::after {
content: "";
width: 6px;
height: 10px;
border: solid #fff;
border-width: 0 2px 2px 0;
transform: rotate(45deg) scale(0);
transition: transform .15s
}
.card-070__text {
display: flex;
flex-direction: column;
gap: 2px
}
.card-070 b {
font-size: 14px
}
.card-070 small {
font-size: 12px;
color: #6b7280
}
.card-070:hover {
border-color: #c7d2fe
}
.card-070:has(input:checked) {
border-color: #4f46e5;
background: #eef2ff
}
.card-070:has(input:checked) .card-070__box {
background: #4f46e5;
border-color: #4f46e5
}
.card-070:has(input:checked) .card-070__box::after {
transform: rotate(45deg) scale(1)
}
.card-070:has(input:focus-visible) {
outline: 2px solid #4f46e5;
outline-offset: 2px
}
HTML
<label class="card-070">
<input type="checkbox">
<span class="card-070__box"></span>
<span class="card-070__text"><b>Weekly digest</b><small>One email every Monday with what changed.</small></span>
</label>Prompt
Erstelle eine 320px auswählbare Options-Card als Label mit versteckter Checkbox. Standard: weiß, 2px #e5e7eb Rahmen, 14px Radius, eine eigene 20px Checkbox als Quadrat mit 2px #d1d5db Rahmen und 6px Radius, 14px fetter Titel und 12px #6b7280 Beschreibung. Nutze :has(input:checked) auf der Card, um den Rahmen auf Indigo #4f46e5 und den Hintergrund auf #eef2ff zu schalten, die Checkbox indigo zu füllen und ein weißes Häkchen zu zeigen (ein gedrehtes Pseudo-Element nur aus Rahmen, das von 0 auf 1 skaliert). Hover tönt den Rahmen #c7d2fe; Tastatur-Focus zeigt per :has(input:focus-visible) eine 2px indigofarbene Outline.