.container { display: flex; align-items: center; position: relative; overflow: hidden; } .checkbox { display: flex; justify-content: center; align-items: center; width: 20px; height: 20px; border: 1px solid var(--base500); border-radius: 4px; } .label { margin-left: 10px; user-select: none; /* disable text selection when clicking to toggle the checkbox */ } .input { position: absolute; visibility: hidden; height: 0; width: 0; bottom: 100%; right: 100%; }