Concepts 🚀 Project 🧮 Labs
🧮 Labs / CSS / Form styling — inputs, labels, focus, validation

Form styling — inputs, labels, focus, validation

Make forms look professional: full-width inputs, clear labels, focus rings, error states.

style.css v3.1
style.css — the CSS rules
index.html — the HTML structure (what the CSS targets)
Live preview updates as you type
🧠 How it works

display: block on labels — puts label above input (not next to it). width: 100% on inputs — full width of the form-group. font-family: inherit — inputs don't inherit body font by default; this fixes it. outline: none + :focus styles — replace the ugly browser default focus ring with a branded one. box-shadow: 0 0 0 3px rgba(...) — the 'glow' around a focused input. Called a 'focus ring'. :invalid:not(:placeholder-shown) — shows red border ONLY after the user types something invalid. Without :not(:placeholder-shown), the input would be red from the start (before typing). :active { transform: scale(0.98) } — button 'presses down' when clicked. Micro-interaction.

✏️ Try these changes
  • Change border: 2px solid #ddd to 1px solid #ccc
    → thinner, lighter border
  • Change the focus box-shadow spread from 3px to 5px
    → thicker focus ring
  • Change :invalid border-color from #f85149 to #ffa657
    → invalid inputs get orange border (warning instead of error)
  • Change .btn-submit background to #f85149
    → submit button becomes red (danger button)
  • Add 'disabled' attribute to the submit button and style .btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }
    → button looks disabled