HTML & CSS
/Beginner
HTML Forms
Definition
The `<form>` element is used to collect user input. It acts as a container for interactive controls (like text fields, checkboxes, and buttons) to submit data to a web server.
Explain Like I'm New
A form is a digital envelope. You put inputs (fields) inside the envelope. The user fills them out. When they click the Submit button, the browser seals the envelope and sends it to the URL specified in the `action` attribute.
Real World Example
The Login screen of every website. It is a `<form>` containing an email input, a password input, and a submit button.
Common Use Cases
- •User registration/login
- •Checkout processes
- •Search bars
Interactive Example
Interview Questions
basic
- What does the `action` attribute do on a `<form>` tag?
intermediate
- What is the difference between `method="GET"` and `method="POST"`?