LibraryCSSForms and Controls

Forms and Controls

Style native inputs, buttons, validation, and focus without breaking their behavior.

Updated Tested with Modern CSS

Native controls vary across browsers because they integrate with the operating system. Normalize only what the design needs and preserve familiar behavior.

Shared control foundations

forms.css
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  min-height: 2.75rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #c9c1cd;
  border-radius: 0.45rem;
  background: canvas;
}
:is(input, select, textarea, button):focus-visible {
  outline: 3px solid #f46537;
  outline-offset: 2px;
}

Validation and disabled states

states.css
input:user-invalid { border-color: #b42318; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
textarea { resize: vertical; min-height: 8rem; }

Do not communicate validity through color alone. Pair visual state with connected error text. Keep disabled controls legible and avoid disabling submit before explaining why.

Keep this

Preserve native semantics, size touch targets generously, style every state, and test keyboard and mobile input.

Your place is saved on this device.