Last updated

Forms & Inputs

Definition: A <form> collects information from the user. Inside it, <input> fields and <button>s let people type and submit data.

Common inputs

<input type="text" placeholder="Your name">
<input type="email" placeholder="you@email.com">
<input type="password">
<button>Submit</button>

The type attribute

  • type="text" — a single line of text
  • type="email" — an email address
  • type="password" — hides the characters
  • type="checkbox" — a tick box

placeholder shows faint hint text inside the field until the user types.

💡 Tip: wrap fields in a <label> so clicking the text focuses the input — better for usability and accessibility.

Try it Yourself
Output

          
Ad · responsive