Skip to main content

Forms & Input Types

You’re doing great! Now, let’s learn how to collect information from users with forms. Forms are how websites get input—like sign-ups, searches, or feedback.

Forms

A form is an element that contains input fields, buttons, and more. It sends data to a server (or handles it in JavaScript).

Example:

<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name" />
<button type="submit">Submit</button>
</form>

Input Types

  • text, password, email, number, checkbox, radio, submit, etc.

Example:

<input type="email" placeholder="you@example.com" />
<input type="checkbox" /> I agree
info

Forms can be styled with CSS and made interactive with JavaScript.

What's Next?

Let’s explore semantic HTML and structure your pages for meaning: Semantic HTML.