Web Technologies β€Ί Level 09
LEVEL 09 Β· HTML

HTML Lists, Tables and Forms

Organize related content, explain tabular data and build forms whose submitted values you can predict.

πŸ“š HTML⏱ Beginner β†’ Intermediate🎯 Practical Web DevelopmentπŸ§ͺ Practice + MCQs
01

Learning Objectives

Level 08 introduced text, links and media. This lesson organizes information and collects user input. You will choose the right list, build a readable data table, associate labels with controls, and explain which values a form submits.

Lists

Use unordered, ordered, nested and description lists according to the meaning of the content.

Tables

Use captions, row and column headers, table sections and carefully chosen cell spans.

Forms

Use labels, names, groups, input types, selects and text areas with appropriate validation.

Submission

Distinguish GET from POST and predict submitted name/value pairs without confusing browser validation with server security.

02

Choose the Structure Before the Tags

Imagine a CodeBhavya workshop page. Its prerequisites are a list, its timetable is a table, and its registration area is a form. Choosing by appearance alone can create confusing markup.

List

Related items: prerequisites, steps or terms. Sequence matters for steps, but not for a collection of topics.

Table

Related values across two dimensions: each workshop row has a topic, day and seat count.

Form

Controls through which the learner provides information or requests an action.

Layout

Use CSS for arranging page regions. A table is for tabular data, not a shortcut for positioning a page.

One workshop page, three information structures
List Β· related items

Prerequisites β†’ HTML basics, links, a code editor.

Table Β· row and column relationships

Workshop Γ— seats β†’ HTML Foundations has 20 seats.

Form Β· learner input

Labelled controls β†’ values ready for inspection.

03

Unordered Lists β€” Related Items

Use <ul> when rearranging the items does not change their meaning. Each item belongs inside an <li>. Browser bullets are a default presentation; CSS can change their appearance.

<ul>
  <li>HTML document structure</li>
  <li>Links and images</li>
  <li>A code editor</li>
</ul>

Expected result: three related prerequisite items. A bullet is not manually typed into each item.

04

Ordered Lists β€” Meaningful Sequence

Use <ol> for steps, rankings or another sequence where position matters. start changes the initial number; reversed reverses numbering; an item’s value sets its number and affects subsequent numbering.

<ol start="3">
  <li>Validate the HTML.</li>
  <li>Test keyboard navigation.</li>
  <li>Publish the page.</li>
</ol>

Expected labels: 3, 4, 5. Numbering alone does not make unrelated content a meaningful sequence.

05

Nested Lists and Description Lists

A nested list belongs inside the parent item, before that item’s closing tag. A description list associates terms or names with descriptions; it does not use li.

<ul>
  <li>Frontend
    <ul><li>HTML</li><li>CSS</li></ul>
  </li>
  <li>Backend</li>
</ul>

<dl>
  <dt>GET</dt><dd>A method used to retrieve a representation.</dd>
  <dt>POST</dt><dd>A method commonly used to submit data for processing.</dd>
</dl>

A term can have multiple descriptions, and multiple terms can share a description. Use the grouping that matches your information rather than forcing every definition into a two-column table.

A nested list keeps each child inside its parent item
Parent li Β· Frontend

Contains an inner ul before the parent closing tag.

Child li Β· HTML

First item inside the inner list.

Child li Β· CSS

Second item inside the same inner list.

06

Table Anatomy β€” Rows, Headers and Cells

table contains a data table, tr creates a row, th identifies a header cell and td contains a data cell. A caption gives the table a meaningful title. thead, tbody and tfoot group rows; they do not create columns.

<table>
  <caption>CodeBhavya workshop seats</caption>
  <thead>
    <tr><th scope="col">Workshop</th><th scope="col">Seats</th></tr>
  </thead>
  <tbody>
    <tr><th scope="row">HTML Foundations</th><td>20</td></tr>
    <tr><th scope="row">Forms Practice</th><td>15</td></tr>
  </tbody>
  <tfoot>
    <tr><th scope="row">Total</th><td>35</td></tr>
  </tfoot>
</table>
CodeBhavya workshop seats
WorkshopSeats
HTML Foundations20
Forms Practice15
Total35

Read the result: the total is 35 seats. The HTML structure communicates the data; borders and spacing in this rendered example come from CSS.

07

Header Relationships and Accessible Tables

For a simple table, scope="col" marks a column header and scope="row" marks a row header. This helps tools associate a value with its context. A visually bold td is still a data cell.

For complex tables with multiple header levels, explicit header IDs and a cell’s headers attribute may be needed. Prefer splitting a complicated table into simpler tables when that makes the information easier to understand.

Keep tables readable on phones with a horizontal scrolling wrapper. Do not remove their semantic structure merely to fit the viewport.

08

colspan and rowspan β€” Plan the Grid

colspan extends a cell across columns; rowspan extends it across rows. Cells covered by a span must not also be added as ordinary cells.

<table>
  <caption>Workshop session plan</caption>
  <thead><tr><th scope="col">Day</th><th scope="col">Session</th></tr></thead>
  <tbody>
    <tr><th scope="row" rowspan="2">Monday</th><td>Lists</td></tr>
    <tr><td>Tables</td></tr>
    <tr><td colspan="2">Independent practice</td></tr>
  </tbody>
</table>

Trace the grid: Monday occupies the first column in two rows. The second row therefore contains only the Tables cell. The final practice cell occupies both columns. Complex spanning also requires careful header associations.

09

Forms β€” Controls, action and method

A form groups controls for submission. action identifies the destination, and method specifies how the browser submits the data. HTML creates the interface; a real destination needs server logic to process and validate it.

<!-- /workshop-register is an illustrative server endpoint. -->
<form action="/workshop-register" method="post">
  <label for="student-name">Student name</label>
  <input id="student-name" name="student" type="text" required>
  <button type="submit">Register</button>
</form>

The endpoint above is an example, not a working CodeBhavya registration service. The interactive lab later in this lesson prevents network submission and shows the payload locally.

10

Labels, id, name and value

id identifies an element in the document; a label’s for matches that ID. name is the submitted field key. value supplies the field value, or its initial value for controls such as a text input.

<label for="learner-email">Email address</label>
<input id="learner-email" name="email" type="email"
       placeholder="learner@example.com" required>

Entering learner@example.com yields the pair email=learner@example.com. An ID does not replace a name. Placeholder text is a hint, not a persistent label. IDs should be unique in the document.

Label, control and submitted pair
Label for="student"

The label points to a control with id="student".

Input id="student"

The input is identified in the page. name="student" supplies the submission key.

Pair Β· student=Asha

An eligible named control contributes its current value.

11

Input Types and Native Validation

Choose a type that matches the data. Types improve browser interaction and, for some controls, provide constraints. Browser presentation varies by device.

text and email

Text is general input. Email checks an email-shaped value, not whether the address exists or belongs to the learner.

number and date

Number supports constraints such as min, max and step. Date represents a calendar date; its visible picker is browser dependent.

password and tel

Password obscures the display but does not encrypt transmission. Telephone input can improve keyboard choice but has no universal built-in phone-number format check.

required and pattern

Required checks that an applicable control has a value. Pattern constrains applicable text-like controls; explain the expected format visibly.

<label for="seat-count">Seats requested (1–4)</label>
<input id="seat-count" name="seats" type="number"
       min="1" max="4" step="1" value="1" required>

Try 0, 1, 4, 5 and 1.5. The allowed values are whole numbers from 1 through 4. Client-side validation can be bypassed; the server must validate independently.

12

Radio Buttons, Checkboxes and Groups

Radio buttons with the same name in the same form form a mutually exclusive group. Checkboxes represent independent choices. A checked checkbox submits its value; an unchecked one contributes no pair.

<fieldset>
  <legend>Attendance mode</legend>
  <label><input type="radio" name="mode" value="online" checked> Online</label>
  <label><input type="radio" name="mode" value="campus"> Campus</label>
</fieldset>
<label><input type="checkbox" name="updates" value="yes"> Send workshop updates</label>

Selecting Campus and leaving updates unchecked yields mode=campus, with no updates pair. Give choice controls explicit values so their meaning is clear.

13

select, textarea, fieldset and Buttons

A select presents options, and the selected option’s value is submitted. A textarea accepts multiple lines; its initial content goes between its tags. A fieldset groups related controls and its legend names that group.

<label for="topic">Workshop topic</label>
<select id="topic" name="topic" required>
  <option value="">Choose a topic</option>
  <option value="html">HTML Foundations</option>
  <option value="forms">Forms Practice</option>
</select>
<label for="notes">Learning goal</label>
<textarea id="notes" name="notes" rows="3">Practise accessible forms.</textarea>
<button type="submit">Submit</button>
<button type="reset">Restore defaults</button>
<button type="button">Show help</button>

Inside a form, a button without an explicit type commonly acts as a submit button. Use type="button" for helper actions. Reset restores initial defaults, which may not be empty values; it does not erase data already stored by a server.

14

Which Values Are Submitted?

For the basic controls in this lesson, a submitted pair generally needs a name and an enabled control. Unchecked checkboxes and radios are omitted. A selected option contributes its value. Repeated names can produce multiple pairs.

disabled

A disabled control is omitted and does not participate in constraint validation. It is not a security boundary.

readonly

A read-only text control can still submit its named value. Readonly applies only to supported control types; it does not make a select read-only.

Hidden fields

A hidden input contributes a named value, but users can inspect and modify it. Never trust a hidden price or role without server checks.

Submit buttons

A named submit button can contribute its own name/value when it is the submitter. A helper button is not submitted as a field.

<input name="course" value="HTML" readonly>
<input name="internalNote" value="Draft" disabled>
<input value="Unnamed field">
<input type="checkbox" name="updates" value="yes">

Expected pairs: only course=HTML, assuming the checkbox remains unchecked. The lab uses an unnamed submit button, so its button adds no field.

15

GET, POST and Encoding

A GET form typically puts encoded data in the URL query. It suits retrieval such as searching. A POST form typically sends data in the request body and is commonly used for actions that change server state. POST by itself is not encryption; HTTPS protects transport for both methods.

The usual form encoding is application/x-www-form-urlencoded. Spaces become + and special characters are escaped. Repeated fields remain separate pairs. File uploads normally use POST with enctype="multipart/form-data".

<!-- Illustrative search endpoint; not a live CodeBhavya route. -->
<form action="/search" method="get">
  <label for="query">Search lessons</label>
  <input id="query" name="q" value="HTML forms">
  <button type="submit">Search</button>
</form>
<!-- Expected request target: /search?q=HTML+forms -->

Do not place passwords in GET queries. A POST body still needs careful handling, server validation, authorization and appropriate protection against unwanted requests.

The same fields can have different request representations
GET Β· query data

Illustration: /workshop-register?student=Asha. Query data is part of the URL.

POST Β· request body

Illustration: student=Asha in the body with a suitable content type.

Server Β· independent checks

Neither method replaces HTTPS, authorization or server validation.

16

Premium Visualizer β€” Form Submission Journey

Follow the sequence from input to processing. This is a conceptual journey; the lab stops before a real network request.

FORM SUBMISSION TRACE
Step 1 of 5
STEP 01

Enter or choose control values

The learner enters a fictional name and selects the workshop options. Nothing has been sent.

student = Asha; topic = html; seats = 1

What is happening?

The form stores current control values in the page. This visualizer explains a fixed example; the next lab lets you inspect your own changes.

17

Premium Interactive β€” Workshop Form Lab

Inspect real browser-generated form pairs. Nothing is submitted to a server or saved by this lab. Use fictional data. Change the method to compare the same data as a URL query and a request body.

Attendance mode

Submission inspection

Press Inspect submission to see which fields contribute.
Copyable form structure
<form id="wt9Form" action="/workshop-register" method="post">
<label for="wt9Student">Learner name (use a fictional name)</label><input id="wt9Student" name="student" value="Asha" required maxlength="60">
<label for="wt9Email">Practice email</label><input id="wt9Email" name="email" type="email" value="asha@example.com" required>
<label for="wt9Topic">Topic</label><select id="wt9Topic" name="topic" required><option value="">Choose a topic</option><option value="html" selected>HTML Foundations</option><option value="forms">Forms Practice</option></select>
<label for="wt9Seats">Seats (1–4)</label><input id="wt9Seats" name="seats" type="number" min="1" max="4" step="1" value="1" required>
<fieldset><legend>Attendance mode</legend><label class="wt9-choice"><input type="radio" name="mode" value="online" checked>Online</label><label class="wt9-choice"><input type="radio" name="mode" value="campus">Campus</label></fieldset>
<label class="wt9-choice"><input type="checkbox" name="updates" value="yes">Include workshop updates</label>
<label for="wt9Course">Course (read-only)</label><input id="wt9Course" name="course" value="Web Technologies" readonly>
<label for="wt9Draft">Internal note (disabled)</label><input id="wt9Draft" name="internalNote" value="Draft" disabled>
<label for="wt9Notes">Learning goal</label><textarea id="wt9Notes" name="notes" rows="3">Practise forms.</textarea>
<div class="wt9-actions"><button class="primary-button" type="submit">Inspect submission</button><button class="secondary-button" type="reset">Restore defaults</button></div>
</form>

The endpoint shown is illustrative. The lab prevents submission even if its script fails to initialize. Copied HTML needs an actual server endpoint and server-side validation before it becomes a real registration form.

18

Common Mistakes and How to Diagnose Them

Nested list outside its parent item

Move the inner ul or ol inside the li it describes. Read the DOM tree rather than judging only indentation.

Headers styled as data cells

Use th and appropriate scope. A bold font alone does not communicate header relationships.

Missing name

A control can be visible and labelled yet absent from the payload. Check name separately from id.

Different radio names

Different names allow simultaneous selection. Use one shared name for alternatives in the same group.

Disabled value expected in the payload

Disabled controls are omitted. If a text value should submit while not being editable, consider readonly where supported.

POST described as secure by itself

Use HTTPS and server checks. Moving data from the query to the body does not encrypt it.

Placeholder used as the only label

Add a visible label. Hints disappear during typing and do not replace the control’s name for users.

Helper button submits unexpectedly

Set type="button" on helper buttons inside a form.

19

Interview Preparation

Reveal each answer, then explain it in your own words with an example.

When should you use ol instead of ul?

Click or press Enter to reveal β†’

Answer

Use ol when sequence or ranking is meaningful; use ul for a related collection without meaningful order.

How do id and name differ?

Click or press Enter to reveal β†’

Answer

id identifies the element and connects labels or fragments. name supplies the submitted field key.

Why use th and scope?

Click or press Enter to reveal β†’

Answer

They communicate header relationships in simple data tables. A styled td remains a data cell.

Does POST encrypt a password?

Click or press Enter to reveal β†’

Answer

No. POST usually places data in the body. HTTPS protects transport; server validation is still needed.

What happens to an unchecked checkbox?

Click or press Enter to reveal β†’

Answer

It contributes no name/value pair. Server logic must handle an absent field appropriately.

How are readonly and disabled different?

Click or press Enter to reveal β†’

Answer

A named read-only text field can submit. A disabled field is omitted and does not participate in validation.

Can HTML validation replace server validation?

Click or press Enter to reveal β†’

Answer

No. Users can bypass browser checks or send requests directly. Validate all submitted data on the server.

Why use fieldset and legend?

Click or press Enter to reveal β†’

Answer

They group related controls and provide a group label, for example attendance radio choices.

20

Quick MCQs

Choose an answer to see why it is correct. Use Reset quiz to practise again.

PRACTICE

1. Which list fits ordered deployment steps?

PRACTICE

2. Where should a nested list be placed?

PRACTICE

3. Which element gives a table its title?

PRACTICE

4. Which marks a simple column header?

PRACTICE

5. Which attribute provides a submitted field key?

PRACTICE

6. Which value is omitted from a normal form submission?

PRACTICE

7. How should mutually exclusive radios be grouped?

PRACTICE

8. An unchecked updates checkbox has value="yes". What does it contribute?

PRACTICE

9. Which statement about POST is correct?

PRACTICE

10. What does type="reset" do?

PRACTICE

11. What does colspan="2" do?

PRACTICE

12. Which is a suitable helper button inside a form?

21

Extra Practice

Prerequisite list

Create three prerequisites with ul. Expected: three sibling li items. Reorder them and explain why the meaning remains intact.

Continuing a sequence

Use ol start="4" with three items. Expected labels: 4, 5, 6. Add value="10" to the second item and predict 4, 10, 11.

Nested study plan

Create HTML and CSS as children of Frontend. Expected: the inner list is contained within the Frontend li.

Workshop table

Create two workshops with 20 and 15 seats. Expected total: 35. Add a caption and headers with scope.

Grid-span reasoning

Make a day header cover two sessions. Expected: the second session row has no duplicate day cell.

Submission boundary cases

In the lab, uncheck updates and inspect. Expected: no updates pair. Switch attendance to campus; expected mode=campus.

Validation boundaries

Try seats 0, 1, 4, 5 and 1.5. Expected: only 1 and 4 pass among these values. Try an empty topic and a malformed email; browser validation blocks inspection.

Encoding and reset

Use name Asha & Ravi. Expected encoding: student=Asha+%26+Ravi. Change seats and reset; expected initial seats 1, not an empty field.

22

Quick Revision

ul / ol / dl: Collection / meaningful sequence / terms and descriptions.
Nested lists: Place them inside the parent li.
table: Use caption, rows, headers and data cells for tabular information.
Labels: Match for to a unique control id.
Submission: name supplies the key; eligible controls contribute values.
Choices: Unchecked checkboxes and radios are omitted.
Methods: GET commonly uses query data; POST commonly uses body data.
Validation: Browser convenience plus independent server checks.
23

Glossary

TERM

List item

Click to see meaning
DEFINITION

List item

One li within an ordered or unordered list.

TERM

Caption

Click to see meaning
DEFINITION

Caption

The title of a table.

TERM

Header cell

Click to see meaning
DEFINITION

Header cell

A th that identifies row or column context.

TERM

Cell span

Click to see meaning
DEFINITION

Cell span

A cell’s extension across multiple rows or columns.

TERM

Form control

Click to see meaning
DEFINITION

Form control

An input, select, textarea or another interactive form element.

TERM

Field name

Click to see meaning
DEFINITION

Field name

The key submitted with a control’s value.

TERM

Constraint validation

Click to see meaning
DEFINITION

Constraint validation

Browser checks for applicable input requirements.

TERM

Encoding

Click to see meaning
DEFINITION

Encoding

A representation of data suitable for transmission.

TERM

Payload

Click to see meaning
DEFINITION

Payload

The data carried by a request.

TERM

Read-only

Click to see meaning
DEFINITION

Read-only

An editing restriction supported by certain control types.

24

Final Challenge β€” Workshop Resource Page

Build a complete HTML document with a prerequisites list, an ordered preparation plan, a captioned timetable and a labelled registration form. Include a topic selector, radio group, optional updates checkbox and seat count from 1 to 4.

Success criterion: explain every submitted field and every omitted field without guessing from its appearance.

25

Level 09 Complete?

Before marking complete, build a list and a simple accessible table, label a form correctly, and predict its submitted pairs. Completion records a local study milestone; it is not an assessment score.