Week 2 Day 1: HTML forms and input validation
This commit is contained in:
32
Week-2/Day-1/advanced-html-css.md
Normal file
32
Week-2/Day-1/advanced-html-css.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Week 2 Day 1 – Advanced HTML & CSS
|
||||
|
||||
## HTML Forms
|
||||
HTML forms are used to collect user input and send data to a server for processing. Forms are a crucial part of web applications such as login pages, registration forms, feedback forms, and surveys.
|
||||
|
||||
### <form> Tag
|
||||
Defines the start and end of a form.
|
||||
Important attributes:
|
||||
action: URL where form data is sent.
|
||||
method: HTTP method (GET or POST).
|
||||
|
||||
### Common Form Elements
|
||||
<input>
|
||||
Types: text, email, password, number, date, radio, checkbox
|
||||
|
||||
<label>
|
||||
Improves accessibility and user experience.
|
||||
|
||||
<textarea>
|
||||
Used for multi-line input.
|
||||
|
||||
<select> and <option>
|
||||
Dropdown selection.
|
||||
|
||||
<button>
|
||||
Submits or resets the form.
|
||||
|
||||
### Form Validation
|
||||
required ensures mandatory fields.
|
||||
type="email" validates email format.
|
||||
maxlength limits input length.
|
||||
placeholder gives hints to users.
|
||||
Reference in New Issue
Block a user