.button-select { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); } .button-select label > span { text-align: center; display: inline-block; user-select: none; cursor: pointer; padding: 0.5rem 0; width: 100%; background: #ddd; border-radius: 4px; border: 1px solid transparent; } .button-select label input { opacity: 0; position: absolute; } /* Wish we could use :has reliably. */ .button-select label input:focus + span { border-color: #eee; outline: 2px solid #666; } .button-select label input:checked + span { color: white; background: #666; }