Sikau

HTML · Day 10 · about 25 min

Inputs and labels

Every field needs a name.

Asking for information

Sign-ups, searches, orders — forms are how visitors talk back. The most important rule: every input needs a label. It tells people (and screen readers) what to type, and clicking it focuses the field.

form, label, input, button

  • <label for="x"> connects to the input with id="x" — or wrap the input inside the label.
  • name is the key the value is sent under when the form is submitted.
  • action is where the form sends data; method="post" for changes, get for searches.
  • autocomplete helps browsers fill in known details.

The rest of this lesson

  • What happens when a form is sentexplain
  • Labels done rightexplain
  • Labelled?predict
  • Connect the labelfill
  • Your turnwrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 17 lessons of HTML