Day 9 – Tables & Forms in HTML | Complete Beginner’s Guide
📥 Download Full Notes + Example Code (PDF) – Click here to get your Day 9 Notes
Introduction
When you start building websites, you’ll quickly realize you need two important things:
-
A way to present data clearly → Tables 📊
-
A way to collect user information → Forms 📝
Both are essential building blocks of HTML and are widely used across the internet:
-
Online exam results pages
-
Price lists on e-commerce sites
-
Contact forms on business websites
-
Registration forms for events
In this guide, you’ll learn:
✅ What tables and forms are in HTML
✅ How to write their code
✅ Common tags used
✅ Styling & accessibility tips
✅ Practice exercises to improve your skills
1. HTML Tables – Display Data in Rows & Columns
A table is made of rows and columns.
HTML tables use these tags:
Tag | Purpose |
---|---|
<table> |
Creates the table container |
<tr> |
Creates a table row |
<td> |
Creates a table cell (data) |
<th> |
Creates a header cell (bold, centered) |
<caption> |
Adds a table title (optional) |
Basic Table Example
Advanced Table Example – With Row & Column Span
2. HTML Forms – Collect User Data
Forms are interactive elements that allow users to submit data to a server.
Tag | Purpose |
---|---|
<form> |
Wraps all form elements |
<input> |
Accepts single-line text, emails, passwords, etc. |
<label> |
Displays a field label |
<textarea> |
Accepts multi-line input |
<select> |
Creates dropdown menus |
<option> |
Dropdown choices |
<button> |
Clickable buttons |
Basic Form Example
Form Example with More Inputs
3. Styling Tables & Forms with CSS
4. Practice Task
-
Task 1: Create a table showing 3 courses with duration and fees.
-
Task 2: Make a form to collect name, email, and preferred course.