Forms, Tables and Media in HTML

Build web forms that collect the right information: choose input types, text areas and drop-down lists, label every control and know what the browser sends. Use the browser's built-in validation to catch missing or badly formatted answers. Present data in clear, accessible tables, add audio and video with captions and fallbacks, and embed maps, videos and other pages safely with iframes.

BeginnerLesson 3 of 8 in Web Development Basics Course

What you will learn

  1. Create a form, choose a control that fits each piece of information, label every control and know exactly what the browser sends when the form is submitted.
    • Set up a form and understand what it sends
      Use the form element, names and values, submit buttons and the action and method attributes to control which data leaves the page and where it goes.
    • Choose input types that fit the data
      Pick the input type that matches each piece of information so browsers offer the right keyboard or picker and check the basic format.
    • Use text areas, drop-down lists and other controls
      Collect longer text, offer fixed lists of choices and typing suggestions, and show progress or measurements with textarea, select, datalist, progress and meter.
    • Label every control and group related ones
      Connect visible labels to their controls, group related controls with fieldset and legend, and add instructions and autocomplete hints so everyone can fill in the form.
  2. Use HTML validation attributes so the browser catches missing, too long, out-of-range and wrongly formatted values before the form is sent, and know where this check stops.
    • Require fields and limit text length
      Use required, minlength and maxlength, and predict when the browser accepts or blocks a submission.
    • Set ranges and steps for numbers, dates and times
      Use min, max and step to accept only sensible values, and predict which values pass.
    • Match patterns and give useful feedback
      Write simple pattern rules, explain them to users, style valid and invalid fields, and understand why the server must check the data again.
  3. Mark up tabular data with rows, cells, headers and a caption, and keep larger tables understandable with header scopes, row and column groups and merged cells.
    • Build a data table with headers and a caption
      Use table, tr, th, td and caption to present data in rows and columns, and give the table a clear structure with header scopes and row groups.
    • Merge cells and connect complex headers
      Use colspan and rowspan correctly, group columns, and link cells to their headers when a table has more than one level of headings.
  4. Embed sound and video with the browser's own players, supply formats and fallbacks that work across browsers, and make media usable for everyone with captions, subtitles and transcripts.
    • Embed audio and video with the right attributes
      Use the audio and video elements with controls, sizes, a poster and loading hints, and decide when autoplay and looping are appropriate.
    • Offer formats and fallbacks that work everywhere
      Choose widely supported file formats, list alternative sources in order and add fallback content.
    • Add captions, subtitles and transcripts
      Write a simple WebVTT file, attach it with the track element and provide transcripts so media works without sound.
  5. Place maps, videos and other web pages inside your own page with iframes, and choose settings that keep each embed accessible, fast, private and secure.
    • Embed a page with an iframe
      Add an iframe with a title, size and lazy loading, adapt an embed code from another site, and recognize sites that do not allow embedding.
    • Keep embeds safe and private, and pick the right element
      Limit what an embedded page may do with sandbox and allow, consider what embeds share about visitors, and choose between iframe, embed, object and the media elements.

HTML Forms study guide

5 chapters

1

Build forms people can use

A useful form starts with the information people need to enter. Choose controls that fit that information, give each one a clear label, and connect the controls to a form that sends meaningful names and values. A search box, a message form, and a file upload all collect input, but they need different settings. Reading the HTML from the user’s entry through to the outgoing request makes those choices easier to check.

1.1 How a form sends names and values

A form collects related answers and sends them to a URL. The <form> element surrounds its controls and submit button. Keep separate forms separate: HTML does not allow a form inside another form.

Choose the destination and method

action names the receiving URL. Without it, the request goes to the current page. method chooses how the browser sends the data; the default is GET.

MethodWhere the data goesTypical use
GETInto the URL after a question markSearches and filters
POSTInto the request bodyMessages, sign-ups, and changes to stored data

GET data can appear in history, bookmarks, and server logs. POST keeps it out of the query string, but does not encrypt it. Use HTTPS to protect data in transit. The server program receives and processes the request; the HTML form does not save or email answers itself.

Follow a search request
<form action="/search" method="get">
  <label for="query">Search</label>
  <input id="query" type="search" name="q">
  <label for="language">Language</label>
  <select id="language" name="lang">
    <option value="en">English</option>
  </select>
  <button type="submit">Search</button>
</form>

If the user enters "html tables", the browser requests /search?q=html+tables&lang=en. It takes the field name q and its current value, encodes the space as +, and joins the two pairs with &. The ? starts the query string.

A control needs a name to contribute data. Its id serves a different purpose: identifying the element on the page, including connecting a label. An input with id="query" but no name can look and work normally while contributing no answer to the request.

Know which controls contribute

An empty named text field contributes an empty value, such as comment=. A checked checkbox contributes its value; without a value it contributes on. An unchecked checkbox contributes nothing. A disabled control is unavailable and omitted. A supported readonly field cannot be edited but still contributes its value.

A hidden input, such as <input type="hidden" name="source" value="newsletter">, contributes a value without a visible control. It is not secret: visitors can inspect and change it in developer tools.

Make button behavior explicit

Inside a form, an ordinary <button> defaults to submitting. Write type="submit" for the send button and type="button" for a button that needs a script. type="reset" restores starting values and can erase a user's work. Pressing Enter in a single-line field also often submits the form. <input type="submit" value="Send"> is another submit control; a <button> can also contain inline content such as an icon.

Send a file's contents
<form action="/upload" method="post" enctype="multipart/form-data">
  <label for="attachment">Attachment</label>
  <input id="attachment" type="file" name="attachment">
  <button type="submit">Upload</button>
</form>

Both POST and enctype="multipart/form-data" are needed for an ordinary file upload. With the default form encoding, file names travel as text but the file contents do not.

Key Takeaways

  • A control’s name identifies its submitted value; id identifies the element on the page.
  • GET puts pairs in the URL; POST puts them in the request body. HTTPS provides transport encryption.
  • Unchecked checkboxes and disabled controls are omitted; supported read-only fields are submitted.
  • Make button types explicit to prevent accidental submission or resetting.
  • File uploads need POST and multipart/form-data.

1.2 Input types and the values they collect

An <input> is a void element, so it has neither content nor a closing tag. Its type selects the control and the browser help that comes with it. Missing or unrecognized types fall back to a text field.

Match text to its purpose
TypeUseBrowser help
textOne line of free textGeneral text entry
searchA search queryMay include a clear button
emailAn email addressEmail keyboard and syntax check
urlA complete web addressURL keyboard and syntax check
telA phone numberPhone keyboard; no format check
passwordA passwordMasks the visible characters

An email field checks syntax, not whether a mailbox exists. Even "ana@example" passes the basic syntax check. Add multiple to accept a comma-separated list of addresses. A URL field expects a scheme: "https://example.com" passes, while "example.com" does not. Phone formats vary, so tel imposes no format rule. Password masking stops nearby people reading the screen; HTTPS still supplies encryption during transmission.

Separate quantities from digit codes

Use number for a quantity, such as a count or a mass. It often has spin buttons for increasing or decreasing the value. Use range for an approximate setting such as volume; its default range is 0–100 and its default value is 50.

A membership code is not a quantity. Use <input type="text" inputmode="numeric"> for a digit code so that leading zeros remain text and spin buttons do not change it. inputmode only suggests an on-screen keyboard: it does not validate the entry. decimal, tel, email, and url are other useful keyboard hints.

Keep display and submitted formats separate

Date pickers follow the user's locale. March 15, 2026 may appear as "03/15/2026" or "15/03/2026", but its submitted date is 2026-03-15.

TypeExample submitted value
date2026-03-15
time14:30
datetime-local2026-03-15T14:30
month2026-03
week2026-W11

These controls do not store a time zone. A local appointment time therefore needs its location or zone explained separately when that matters.

Offer independent or single choices

Checkboxes are independent: several can be checked. Radio buttons form a single-choice group when their name values match. Give each radio button a distinct value and use checked for a default.

<label><input type="radio" name="size" value="S"> Small</label>
<label><input type="radio" name="size" value="M" checked> Medium</label>
<label><input type="radio" name="size" value="L"> Large</label>

The default selection sends size=M. Different names would create separate groups and allow multiple selections.

Choose colors and files

color provides a picker and can send an RGB color such as #ff8800. file opens a file chooser; accept=".pdf,image/*" suggests PDFs and images, and multiple permits several files. The filter helps users choose; the server must still check the received file’s type and contents. For controls that use it, value sets the starting value, which remains the submitted value if the user makes no change.

Key Takeaways

  • Choose a type for the meaning of the data, not just its appearance.
  • Email and URL types check syntax; tel and inputmode do not.
  • Use text plus a numeric keyboard hint for digit codes.
  • Date and time displays vary by locale; submitted formats are fixed and carry no time zone.
  • Radio buttons share a name for one choice; checkboxes allow independent choices.
  • A file chooser’s accept filter is not a security check.

1.3 Long answers, fixed choices, and suggestions

A single-line input does not suit every answer. Longer text needs space, while a fixed set of choices needs controls that show what is allowed. Decide whether the user may enter something outside the choices before picking the element.

Give longer text a text area
<label for="message">Message</label>
<textarea id="message" name="message" rows="5" cols="40"></textarea>

rows gives the visible number of lines and cols the approximate width in characters. Neither limits how much text can be entered; use maxlength for a length limit. Initial text belongs between the tags, not in a value attribute. Spaces and line breaks there become part of the starting value, so adjacent opening and closing tags make a truly empty box.

Send a value from a drop-down list
<label for="delivery">Delivery</label>
<select id="delivery" name="delivery" required>
  <option value="">Choose delivery</option>
  <option value="standard">Standard (3–5 days)</option>
  <option value="express">Express (next day)</option>
</select>

Choosing "Express (next day)" sends delivery=express. The visible wording can explain a choice while its value stays short and stable. If an option has no value, its text is submitted. Add selected to preselect an option. Here, the first option has an empty value, so the required single-choice list cannot be submitted until the user picks a delivery method.

Group or allow several options

An <optgroup label="Hot drinks"> gives related options a heading. That heading is not itself a choice. A select with multiple permits several selected options, and size sets its visible rows. Each selected value becomes a separate pair with the same name: topics=html&topics=css.

Desktop multi-select often requires Ctrl-click or Cmd-click. For a short list of independent choices, checkboxes usually make the selection clearer. For a short single-choice list, radio buttons keep every option visible. A long fixed list is a useful place for a select.

Suggest without restricting
<label for="city">City</label>
<input id="city" name="city" list="cities">
<datalist id="cities">
  <option value="Nairobi">
  <option value="Osaka">
</datalist>

The input's list matches the datalist's id. Users see suggestions but may still type another city. A datalist is therefore useful for common answers to an open question. Replacing a select with a datalist changes the accepted choices; it does not merely change how the same fixed list looks.

Display progress or a measurement

<progress> and <meter> display values instead of collecting answers. A progress bar tracks completion, such as <progress value="70" max="100">70%</progress>. A meter shows a measurement in a known range: <meter value="0.6">60%</meter> can represent storage used. A meter defaults to a range of 0–1 unless min and max change it. Text inside these elements supplies fallback wording when the bar cannot be drawn. Keep an explanatory label beside either display so users know what its number measures.

Key Takeaways

  • A text area’s starting value is its content; rows and cols only set its visible size.
  • A select sends selected option values and can enforce a fixed choice.
  • A datalist suggests answers but allows other text.
  • Use progress for task completion and meter for a measurement in a known range.

1.4 Visible labels and helpful form instructions

A field needs a name that stays visible while the user fills it in. A connected <label> also gives the control an accessible name for screen readers and makes its text a larger clickable target. Instructions explain any rule the label alone cannot convey.

Connect the label to the control
<label for="email">Email address</label>
<input id="email" name="email" type="email" autocomplete="email">

The label's for matches the input's id, including case. The name controls submission and need not be the same. Every id must be unique on the page. If for="email" points to a name but no matching id, the label looks normal yet is not connected.

Another option is to wrap the input in the label:

<label>
  <input type="checkbox" name="news">
  Send me the monthly newsletter
</label>

This implicit connection is useful for a short checkbox label. An explicit for and id pair also works when the label and control are separated in the HTML.

Keep labels separate from examples

A placeholder such as "name@example.com" disappears when typing starts. It may also be hard to read and is not a dependable accessible name. Keep the visible label; use a placeholder only as a short example when it helps.

Mark required fields in words, such as "Name (required)", or explain an asterisk once above the form. Color alone cannot tell everyone what is required. Explain a format before users try to submit it.

<label for="pw">Password (required)</label>
<input id="pw" name="password" type="password"
       required minlength="8" aria-describedby="pw-hint">
<p id="pw-hint">Use at least 8 characters.</p>

aria-describedby points to the hint's id. It adds the instruction as a description after the field's name; it does not replace the label.

Name a group of controls
<fieldset>
  <legend>Delivery speed</legend>
  <label><input type="radio" name="speed" value="standard"> Standard</label>
  <label><input type="radio" name="speed" value="express"> Express</label>
  <label><input type="radio" name="speed" value="pickup"> Pickup</label>
</fieldset>

The legend gives the shared question; each label names an answer. A fieldset can also group related address fields. Put the legend first. disabled on a fieldset disables its descendant controls, except controls inside its first legend. Keep ordinary form controls outside the legend so this exception does not cause surprises.

Help browsers fill known details

autocomplete describes the purpose of information about the user. Values include name, email, tel, street-address, postal-code, country-name, bday, new-password, current-password, and one-time-code. Accurate purposes support saved-data entry and WCAG 2.2 criterion 1.3.5, Identify Input Purpose (AA). autocomplete="off" is a request; browsers may still offer saved passwords.

For an optional phone field, use the label "Phone number (optional)" with type="tel", name="phone", and autocomplete="tel". Click its label to check focus, then move through the form using Tab. Test every label this way, including labels beside checkboxes and radio buttons.

Key Takeaways

  • A visible label needs a real connection to its control.
  • for matches a unique id; submission uses name.
  • A legend names a fieldset, while labels name its individual controls.
  • Connect visible hints with aria-describedby and mark required fields in text.
  • Use accurate autocomplete purposes and check the form with clicks and the keyboard.
2

Check answers before submission

The browser can catch missing answers, text of the wrong length, values outside a range, and entries that do not match a fixed format. Those checks begin with the input type and HTML attributes. Work through how several rules combine, including the cases where an empty value is allowed. Clear instructions help people correct an entry; server checks remain necessary because browser rules can be bypassed.

2.1 Required fields and text length

Built-in validation checks a form's controls when the user submits. A failing control blocks submission; the browser focuses the first invalid field and supplies a message in its own language. The exact wording is chosen by the browser. Changing that wording takes JavaScript.

Require an answer

required means a control needs a value. For a text field, an empty string fails. On a checkbox, required means that particular box must be checked, as for accepting terms. For radio buttons with the same name, putting required on one member means that one button in the group must be selected. A required single-choice select with an empty first option needs a nonempty selection.

<label for="username">Username (required)</label>
<input id="username" name="username"
       required minlength="4" maxlength="12">

The browser combines these rules. The field must contain an answer, and user-entered text must fit the length limits. Leaving off type gives the normal text input.

Count the entered characters

minlength sets the smallest allowed length and maxlength the largest. Spaces and punctuation count. Length is measured in UTF-16 code units, so some emoji count as two; ordinary Latin letters each count as one.

In this example, "Li" is two characters and fails the minimum. "Lina" has four and passes. "mountainhiker" has 13 characters. During ordinary typing, the browser stops after the twelfth, leaving "mountainhike". The width of a text box does not set this limit.

Treat presence and length as different rules

An optional field with minlength="4" can be empty. The minimum length is checked once the user provides a value. Adding required makes an empty entry fail as well. This matters for an optional nickname: a user may omit it, but a supplied nickname still needs enough characters.

required is a boolean attribute. Its presence turns it on, including required="false". To make the field optional, remove the attribute. The same presence rule applies to many other HTML switches.

Know what these checks do not decide

A string of spaces is still content in a text field. required therefore accepts it, and the spaces also count toward the length. A rule needing a visible character requires a suitable pattern or a server check. Do not tell users that required alone guarantees a meaningful answer.

Length constraints also depend on how the value was entered. A starting value written in HTML, or one assigned by a script, is not flagged by minlength or maxlength merely for being too short or too long. A correct default value still matters even when ordinary typing is constrained.

To check this field, try an empty submission, then enter two letters, four letters, and more than 12 letters. Each trial isolates a different rule. When the browser stops typing at the limit, read the value actually left in the field instead of assuming the whole attempted entry was accepted.

Key Takeaways

  • required and length limits solve different problems.
  • Boolean attributes remain on even when written with the value "false".
  • Spaces count as content; some emoji use two UTF-16 code units.
  • One required radio button makes its shared-name group require a selection.

2.2 Limits and allowed steps

A numeric or date value can have the right format and still be unsuitable. min and max set its boundaries; step sets which increments are allowed inside them. A number must pass both checks.

Set the range
<label for="weight">Parcel weight (kg)</label>
<input id="weight" name="weight" type="number"
       min="0.5" max="30" step="0.5">

The endpoints are included. Values from 0.5 to 30 kg are in range, but they must also land on half-kilogram steps. Starting at 0.5 gives 0.5, 1, 1.5, and so on through 30: 60 allowed values. An entry of 31 exceeds the maximum; 2.25 is in range but fails the step.

Find the starting point before counting

Steps count from min when present. Otherwise they count from a valid HTML value attribute, then from the type's default base. For number, that default base is 0. The default step is 1.

With min="1" step="2", accepted values are 1, 3, 5, 7, and so on. Four fails even though it is a multiple of two, because the sequence starts at one. With min="0.5" and no step attribute, the step is still one: 0.5, 1.5, and 2.5 pass, while 1 and 2 do not.

If neither min nor a value attribute supplies a different base, a default number field accepts whole numbers. Use step="0.01" for increments of one hundredth or step="any" to remove the step check. any does not remove the minimum or maximum.

Use the right units for dates and times
TypeDefault stepExample limit
number or range1max="30"
date1 daymin="2026-06-01"
time60 secondsmax="17:00"

A date input with min="2026-06-01" max="2026-08-31" accepts dates in that inclusive interval. Write the attributes in the submitted format, even if the picker displays another date order.

For appointments, type="time" min="09:00" max="17:00" step="900" uses 900 seconds, or 15 minutes, per step. The sequence begins at 09:00 and ends at 17:00. There are 32 intervals and 33 selectable times, including both endpoints.

Separate typing from the stored value

Some localized browsers allow the decimal entry "2,5" but submit 2.5. Text that is not a number is blocked or leaves the number value empty, depending on the browser. An optional empty input is still allowed unless required is present.

A range slider stays within its allowed range and snaps to steps, so users do not encounter the same range and step errors as with a typed number. Separately, nonempty email and url fields undergo type checks even without required: making an answer optional does not make a malformed supplied answer valid.

Key Takeaways

  • Check boundaries and step alignment separately.
  • Find the step base in order: min, HTML value, then the type’s default base.
  • step="any" removes the step check but keeps other constraints.
  • Time steps are seconds; date steps are days.
  • Count endpoints when finding the number of allowed times.

2.3 Fixed patterns and useful feedback

A pattern is useful when an organization defines an exact text format, such as a product code. The browser checks the whole nonempty value against the pattern. Explain the format beside the field so users can meet it before an error appears.

Build a small pattern
<label for="code">Product code (required)</label>
<input id="code" name="code" required
       pattern="[A-Z]{3}-[0-9]{4}" aria-describedby="code-hint">
<p id="code-hint">Use 3 capital letters, a hyphen, and 4 digits (ABC-1234).</p>

[A-Z] matches one capital Latin letter and {3} repeats it exactly three times. The hyphen outside the character groups is literal. [0-9]{4} requires four digits. "ABC-1234" passes. "abc-1234", "ABC1234", and "ABC-12345" each break a different part of the rule.

Pattern partMeaning
[A-Za-z]One basic Latin letter
{2,5}Two to five repetitions
+One or more repetitions
?Optional preceding item
(cm|mm)Either of the two alternatives, cm or mm

Patterns are whole-value matches, so extra text at either end fails. Do not add the surrounding slashes used in JavaScript regular expressions. pattern applies to text-like inputs such as text, search, tel, email, url, and password, not to a text area. Empty values skip the pattern check; required handles an empty answer.

Write literal punctuation carefully

Characters such as ., +, and ? have special meanings. Escape them when they must appear literally: \. matches a period. Inside a character group, modern HTML patterns also require escaping punctuation such as a literal hyphen: [a-z0-9\-]. This hyphen is different from the one defining the range a-z.

An invalid pattern is ignored. Other rules, including required and type checks, still run. Test a pattern with both passing and failing entries; a form that submits one expected value has not yet shown that the pattern rejects anything.

Explain the rule and the error

Keep visible hint text next to the control. A title may contribute to some browser messages; keep the format instruction visible beside the field. Avoid rigid patterns for names, phones, or postal codes unless the accepted format truly is fixed; valid international answers can differ greatly.

CSS offers :valid and :invalid for a field's current validation state. :user-invalid delays the invalid state until user interaction, avoiding an untouched form covered in error styling. Pair colors with words or an icon so the distinction remains visible without color perception.

Decide when checks run

novalidate on the form skips browser validation during submission. formnovalidate on one submit button skips it for that button, which can support "Save draft" beside a normal "Send" button. Browser checks can also be removed through developer tools or bypassed by a direct request. The server must check incoming data again before trusting it.

Key Takeaways

  • A pattern checks the entire nonempty value; required handles absence.
  • Match fixed organization codes with patterns and explain their format visibly.
  • A malformed pattern is ignored while other constraints continue to apply.
  • Use validation-state styling with more than color alone.
  • A skipped or bypassed browser check makes server validation essential.
  • formnovalidate affects one submit button; novalidate affects the form.
3

Make tables that explain their data

A data cell makes sense through its row and column. HTML tables let you express those relationships so people can read a figure alongside the headings that explain it. Start with a caption and simple headers, then add row groups or merged cells only when the data needs them. Counting the grid and connecting each value to its headers keeps the table useful when it is read aloud as well as when it is viewed.

3.1 Rows, headers, and a clear table title

Use a table when a value depends on both its row and its column: a training log, a timetable, or a comparison of measurements. Use CSS for page layout. A layout made from table cells creates misleading row-and-column relationships for screen readers and adapts poorly to narrow screens.

Build the structure from the data

<table> holds the table, <tr> a row, <th> a header cell, and <td> a data cell. Cells are written left to right inside each row. A bold data cell is still a data cell; use <th> to express a heading.

<table>
  <caption>Running log, week 12</caption>
  <thead>
    <tr>
      <th scope="col">Day</th>
      <th scope="col">Distance (km)</th>
      <th scope="col">Time (min)</th>
    </tr>
  </thead>
  <tbody>
    <tr><th scope="row">Monday</th><td>5.0</td><td>28</td></tr>
    <tr><th scope="row">Wednesday</th><td>7.5</td><td>45</td></tr>
    <tr><th scope="row">Saturday</th><td>10.0</td><td>62</td></tr>
  </tbody>
  <tfoot>
    <tr><th scope="row">Total</th><td>22.5</td><td>135</td></tr>
  </tfoot>
</table>

The caption is the first element inside the table. It tells readers what the whole table describes before they encounter its values. A nearby heading may help visually, but the caption attaches the title to the table itself.

Connect each value to its headings

scope="col" says that a header applies down a column. scope="row" says that it applies across a row. The value 7.5 therefore belongs to the row "Wednesday" and the column "Distance (km)". A screen reader can announce that full meaning instead of an isolated number.

Put units in the column headings so they apply consistently. Every distance here is in kilometers; every time is in minutes. The total distance comes from 5.0, 7.5, and 10.0, giving 22.5 km. The times 28, 45, and 62 give 135 min.

Give each group a role

<thead> groups header rows, <tbody> the main data, and <tfoot> the summary after the body. These groups describe the structure and provide CSS hooks. Browsers insert a <tbody> around ordinary rows written directly inside a table, so the displayed structure can differ from the ungrouped source.

Check meaning as well as appearance

Each row here covers three columns. Leaving out a data cell does not tell the browser which internal value is missing: later cells can sit under the wrong heading. Write the cells in their correct positions and use "0" for a known zero or "n/a" when a value does not apply. An unexplained empty cell leaves readers guessing.

Tables have no default borders. For simple lines, apply border: 1px solid to the cells and border-collapse: collapse to the table. The old border attribute is obsolete. A border helps show the grid, but it cannot supply missing header relationships or correct a misplaced value.

Key Takeaways

  • Tables express row-and-column relationships in data.
  • Use th for headings and td for data; visual bolding does not supply semantics.
  • Place a caption first and use scope to connect simple headers.
  • Group rows with thead, tbody, and tfoot, and check every row’s column coverage.
  • Put units in headers and make missing-data meanings explicit.

3.2 Merged cells and layered headings

Merged cells let one entry cover several positions in the grid. They change how many new cells a row needs, so plan the occupied positions before writing the tags.

Count a merged timetable

Consider three columns: "Time", "Monday", and "Tuesday". At 09:00, Monday has "Forms" and Tuesday has "Tables". At 10:00, Monday begins "Validation", which continues through the 11:00 row. Tuesday has "Media" at 10:00 and "Embeds" at 11:00. At 12:00, "Lunch break" covers both days.

<tr>
  <th scope="row">10:00</th>
  <td rowspan="2">Validation</td><td>Media</td>
</tr>
<tr>
  <th scope="row">11:00</th><td>Embeds</td>
</tr>
<tr>
  <th scope="row">12:00</th><td colspan="2">Lunch break</td>
</tr>

At 11:00, the Monday position is already occupied from above. The new cells are only the time header and Tuesday's entry. Adding another Monday cell would push the final value into a fourth column. At 12:00, the time header covers one column and the lunch cell covers two, for three in total.

colspan spans columns horizontally; rowspan spans rows vertically. Both default to one. When checking a row, count the positions filled by new cells and by spans from earlier rows.

Describe groups of columns

<colgroup> and <col> describe columns and appear after the caption but before the row groups. <col span="2"> represents two columns. Only a limited set of styles applies through these elements, including backgrounds, width, visibility, and borders under the relevant table border rules. They do not replace headers.

For "Distance (km)" above two columns named "Planned" and "Actual", define those two columns as a group. Give the upper heading colspan="2" scope="colgroup"; give the lower headings scope="col". The span controls width, while scope states the header relationship. A column-group scope needs a matching column group in the table structure.

Link headers explicitly when needed

For relationships that scope cannot express clearly, give headers unique IDs and list them in the data cell's headers attribute:

<table>
  <caption>Monday distance plan</caption>
  <colgroup></colgroup>
  <colgroup span="2"></colgroup>
  <thead>
    <tr>
      <th rowspan="2" scope="col">Day</th>
      <th id="distance" colspan="2" scope="colgroup">Distance (km)</th>
    </tr>
    <tr>
      <th id="planned" scope="col">Planned</th>
      <th id="actual" scope="col">Actual</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th id="mon" scope="row">Monday</th>
      <td headers="mon distance planned">8</td>
      <td headers="mon distance actual">7.5</td>
    </tr>
  </tbody>
</table>

The planned value of 8 points to Monday, Distance (km), and Planned. The actual value of 7.5 shares the row and group headers but points to Actual. The space-separated names must match the header IDs, not their visible wording.

A header's abbr can provide shorter repeated wording, such as <th abbr="Distance">Distance covered in kilometers</th>. Some screen readers use that shorter form. When many spans or three heading levels make a table hard to follow, split the data into simpler tables with individual captions. Avoid nesting a table inside another table's cell.

Key Takeaways

  • Count occupied grid positions, including spans from earlier rows.
  • A colspan replaces neighboring cells; a rowspan occupies positions in later rows.
  • Use column groups with scope="colgroup" for grouped headings.
  • A cell’s headers lists the IDs of its header cells.
  • Prefer simpler tables when merges and heading levels hide the relationships.
4

Add media people can watch and hear

A player is only part of usable media. Visitors also need a supported file, a way to start and stop it, and access to its information when sound or images are unavailable. Build the player from the media file outward: reserve its space, offer suitable sources, and attach checked captions or a transcript. Loading hints and sensible playback choices also help visitors manage the time and data a video consumes.

4.1 Players, playback, and download choices

<video> and <audio> link media files to a page. The browser downloads those separate files; the video or sound is not stored inside the HTML. Adding controls exposes the browser's play, pause, timeline, and volume controls.

<video src="intro.mp4" controls width="640" height="360"
       poster="intro-poster.jpg" preload="metadata"></video>
<audio src="episode-12.mp3" controls></audio>

Without controls, an audio element has no visible player and a video has no visible play button. A page would need scripted controls to give users that access. For a basic page, keep the native controls.

Reserve the right shape

width and height take plain numbers in CSS pixels. They reserve space while a video loads, reducing page movement. A 1920 × 1080 video shown at a width of 640 has a matching height of 360: the width has been divided by three, so the height must also be divided by three. A differently shaped player box keeps the picture's proportions and adds empty bands.

poster supplies a still image before playback. Without one, the browser waits for media data before it can show the first frame. The poster is useful when little or no video is preloaded.

Decide how much to preload
ValueLoading hint
noneDo not preload the media
metadataFetch information such as duration and dimensions
autoThe browser may download the whole file

These are hints: the browser may override them. Autoplay also takes priority over preload. none is useful for long media that many visitors will not watch; metadata helps show duration without intentionally fetching the full clip.

Understand playback switches

controls, autoplay, muted, loop, and playsinline are boolean attributes. Their presence enables them: muted="false" still starts muted. Remove the attribute to turn it off.

Autoplay with sound is commonly blocked until user interaction, subject to browser permissions and settings. Muted video is more often allowed; Safari on iPhone also needs playsinline for this use. A silent looping clip can use autoplay muted loop playsinline. loop restarts the clip after its end. Do not depend on autoplay to communicate essential information.

Automatic sound can compete with a screen reader, and movement can distract. WCAG 2.2 criterion 1.4.2 (A) requires a way to pause or stop automatic audio longer than three seconds, or control its volume independently. Criterion 2.2.2 (A) addresses automatically moving content that lasts over five seconds alongside other content, unless essential. Keep an available pause mechanism; native controls provide one for these media players.

Estimate the data cost

A two-minute clip at 5 megabits per second contains 600 megabits. Dividing by eight gives about 75 megabytes before extra overhead. Shorter clips and a suitable preload hint reduce unnecessary transfers. A hosted platform's iframe player can shift delivery away from your site's server, but visitors still download media when they watch it.

Key Takeaways

  • Keep native controls so visitors can start, pause, and adjust playback.
  • Use numeric width and height to reserve a video’s space.
  • Preload is a hint; autoplay can override it.
  • Boolean attributes are enabled by their presence.
  • Plan for autoplay restrictions and give users control over automatic sound or movement.
  • A platform player changes who delivers the media, not the visitor’s need to download it.

4.2 Alternative sources and dependable backups

A media extension identifies its container, the file structure holding picture and sound. Codecs compress and decode the streams inside it. A browser must support both the container and its codecs; an .mp4 extension alone does not establish what is inside.

Choose suitable formats

MP4 with H.264 video and AAC audio is a broad-compatibility choice on common current systems. WebM with VP9 or AV1 video and Opus audio is also widely supported and can reduce size at a given quality. For audio, MP3 is a widely supported single choice. Support still depends on the actual codec and the user's system, so test the files themselves.

Offer sources in priority order
<video controls width="640" height="360" poster="tour.jpg">
  <source src="tour.webm" type="video/webm">
  <source src="tour.mp4" type="video/mp4">
  <p>Your browser cannot play this video.
    <a href="tour.mp4">Download the tour video (MP4)</a>.
  </p>
</video>
<p><a href="tour.mp4">Download the tour video (MP4)</a></p>

The browser tries child sources in order and uses the first playable one. WebM is preferred here; MP4 offers another path if WebM cannot be played. Leave src off the <video> itself when using child sources. A src on the media element takes precedence and the child source list is ignored.

The type is a MIME type describing the file. It lets the browser skip an unsupported format without first fetching media data. A wrong type can cause a playable file to be skipped, so the declaration must match the actual file. Listing the same incompatible encoding under a different name does not create a compatible alternative.

Put the backup where it remains available

Content inside <video> is fallback for a browser that does not recognize the video element. A modern browser that recognizes it but cannot play any source does not reveal that inner paragraph as a general error message. The separate download link outside the player stays available in that case. A backup link and alternative sources solve different failures.

Apply the same pattern to audio
<audio controls>
  <source src="episode-12.opus" type="audio/ogg; codecs=opus">
  <source src="episode-12.mp3" type="audio/mpeg">
  <p>Your browser cannot play this audio.</p>
</audio>
<p><a href="episode-12.mp3">Download episode 12 (MP3)</a></p>

This first file uses an Ogg container with Opus audio. The MP3 alternative uses audio/mpeg, the correct MIME type for MP3. The browser cannot infer from the fallback paragraph that it should switch files; source elements supply that choice. When checking the page, verify the paths, the actual file formats, and playback, then confirm the external download link works separately.

Key Takeaways

  • Playback requires support for both container and codecs.
  • Child sources are tried in order when the media element has no src.
  • Accurate MIME types help browsers choose a playable source.
  • Keep a download link outside the player for source failures in modern browsers.

4.3 Captions, transcripts, and WebVTT timing

Media information needs another route when a person cannot hear or see it. Captions include speech, speakers, and meaningful sounds. Subtitles transcribe or translate dialogue for people who hear the audio but need help understanding it. A transcript gives speech and important sounds as text near the player or through a clearly named nearby link. Audio description narrates important visual information.

Attach a caption track
<video controls>
  <source src="intro.mp4" type="video/mp4">
  <track kind="captions" src="intro.en.vtt"
         srclang="en" label="English" default>
</video>
<p><a href="intro-transcript.html">Read the introduction transcript</a></p>

Place <track> after the sources. src points to a text-track file, kind identifies its purpose, srclang identifies the language, and label supplies the player's menu text. A subtitle track must have srclang; include it for captions too. Only one track should carry default. With no kind, the default is subtitles.

Write the caption file

WebVTT is UTF-8 text saved with a .vtt extension. The first line is WEBVTT, followed by a blank line. Each cue then has a timing line and its text, with a blank line before the next cue. An optional identifier can precede a cue's timing.

WEBVTT

00:00:01.000 --> 00:00:04.500
MAYA: Welcome to the workshop.

00:00:05.000 --> 00:00:07.250
[door closes]

00:00:07.500 --> 00:00:11.000
MAYA: Let's build our first form.

The first cue lasts 3.5 seconds, the second 2.25 seconds, and the third 3.5 seconds. The sound cue communicates something a listener hears even though nobody speaks.

Keep timing syntax exact

Minutes and seconds use two digits; milliseconds use three after a period. Hours may be omitted: 01:05.000 means one minute and five seconds. The end must be later than the start. A blank line ends a cue, so keep all its text together without a blank line in the middle.

SRT uses comma timestamps such as 00:00:01,000; a track needs WebVTT instead. Conversion requires the WebVTT header and period timestamps, with the rest of the cues checked for valid syntax. Renaming an .srt extension does not convert its contents.

Check delivery and accessibility

Keep the track on the same origin as the page: the same scheme, host, and port. A track from another origin needs a suitable crossorigin setting on the video and permission from that server. A correct file can otherwise fail to load.

WCAG 2.2 criterion 1.2.2 (A) requires captions for prerecorded video with audio, subject to its media-alternative exception. Criterion 1.2.1 (A) requires an alternative for prerecorded audio-only content, such as a transcript for a podcast. Check automatic captions for names, technical terms, speaker changes, and sounds before publishing.

Other track kinds include descriptions, chapters, and metadata. Browser players do not generally show these as ordinary captions. Do not put essential visible instructions in a metadata track and expect them to appear on screen.

Key Takeaways

  • Captions include meaningful sounds and speaker information; subtitles focus on dialogue.
  • Attach a .vtt file with track and identify its purpose and language.
  • A WebVTT cue needs valid period timestamps, text, and a separating blank line.
  • Check caption accuracy and provide a nearby transcript route.
  • Cross-origin tracks need both browser settings and server permission.
5

Embed another page with care

An iframe gives another web page a window inside your own. That page brings its own code, permissions, loading behavior, and dependence on its provider. Give the window a useful name and size, then choose when it loads and what it may do. Understanding that an embed is a separate document helps explain blocked frames, privacy choices, and why your page’s styles do not reach into another site’s player.

An <iframe> is an inline frame: it displays a separate web page inside the current page. That document has its own HTML, CSS, and scripts. Your page's styles can size the frame but do not style the contents of another document inside it.

Start with a clear, sized frame
<iframe src="https://maps.example.com/venue"
        title="Map of the venue"
        width="600" height="400" loading="lazy"></iframe>
<p><a href="https://maps.example.com/venue">Open the venue map</a></p>

src names the page to load. The title tells a screen-reader user what is in the frame before entering it. "Map of the venue" describes its purpose; "iframe" or "content" does not. The direct link offers another route if the visitor's browser blocks the frame.

width and height take plain numbers in CSS pixels. Without them, the default frame is 300 × 150 CSS pixels. Browsers also draw a default border. Style that with CSS instead of the obsolete frameborder attribute.

Adapt supplied embed code

Map and video services usually offer an embed snippet under their share controls. After pasting it, inspect the URL, improve the title, check the dimensions, and remove obsolete presentation attributes. An iframe URL is a page or service player address, not necessarily a direct media file.

Use HTTPS for the embedded address. An HTTP frame inside an HTTPS page is active mixed content and is blocked. Merely writing a title or changing the frame's size cannot make an insecure URL load.

Load at a useful time

loading="lazy" delays a frame until it is near the viewport, saving initial work for a map far down the page. The default eager starts loading immediately. Use eager loading for a prominent embed at the top so visitors do not wait for its main content. Lazy loading changes timing; it does not remove the network contact when the frame eventually loads.

To fit a player to its container, CSS can set its width to 100% and preserve its shape:

iframe.video-player {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
}

Apply class="video-player" to the relevant iframe. The HTML dimensions still provide starting information, while CSS controls the displayed size.

Recognize a provider's refusal

A site can prohibit framing through the HTTP response header X-Frame-Options or a Content Security Policy frame-ancestors rule. The browser may show a blank frame or error. These restrictions help prevent clickjacking, where a deceptive framed page captures clicks intended for something else.

Your page's HTML cannot override the other site's refusal. Use the provider's permitted embed address if it offers one; otherwise supply an ordinary link. Also keep that link for future failures: if a provider removes or moves its content, an unchanged iframe on your page can stop working.

Key Takeaways

  • An iframe contains a separate document with its own styles and scripts.
  • Give every frame a descriptive title and sensible size.
  • Use lazy loading for offscreen embeds and HTTPS URLs.
  • A provider can refuse framing; offer a direct link when it does.

5.2 Permissions, privacy, and element choice

A third-party embed contacts its provider when the embedded content loads, even before a visitor presses play. That request reveals information such as an IP address and may involve cookies. Decide whether the page needs that contact immediately and what access the embedded document needs.

Delay contact when appropriate

Lazy loading delays an offscreen frame until it is near the screen. A preview that loads an embed only after a click gives visitors a more direct choice. Some services also offer privacy-enhanced modes. A same-site frame does not inherently contact a different provider; inline srcdoc avoids fetching a separate page, though resources referenced by that HTML can still make network requests.

Restrict document behavior with sandbox
<iframe src="https://quiz.example.com/start"
        title="Practice quiz"
        sandbox="allow-scripts allow-forms"></iframe>

An empty sandbox applies its full restrictions, including blocking scripts, form submission, and pop-ups, and assigning an opaque origin. Tokens lift selected restrictions. Here the quiz may run scripts and submit forms, but allow-popups was not granted. Add only tokens the content needs; otherwise a copied permission list can undo useful limits.

allow-same-origin lets the document keep its normal origin. Do not combine it with allow-scripts for embedded content from your own origin: that combination can let the document remove its sandbox. A sandbox also does not mean a frame makes no network requests.

Grant browser features separately

allow is a permissions policy for features such as fullscreen, picture-in-picture, camera, and microphone. A video player can request allow="fullscreen; picture-in-picture". It does not need camera access merely because it contains video. The older allowfullscreen grants fullscreen access too.

Sandbox tokens govern document behavior; feature permissions answer a different question. Granting fullscreen does not by itself let a sandboxed page submit a form or run a script.

Control the referrer and inline content

referrerpolicy="no-referrer" omits the referring page address from the request. With the usual default policy, a cross-origin HTTPS request sends the origin rather than the full path; downgrade requests send no referrer. This controls one header, not all information a provider receives.

srcdoc supplies the frame's HTML directly and takes precedence over src:

<iframe title="Message preview" sandbox
        srcdoc="<p>Preview of your message</p>"></iframe>

The sandbox keeps this small preview restricted. More general HTML previews need care about the resources and markup they allow.

Select the element for the resource
ResourceElement
Pictureimg
Audio or video fileaudio or video
A web page, map, or service playeriframe
External document such as a PDFobject or embed

<object> can contain fallback content, such as a download link, if the resource cannot be displayed. Old plug-in content such as Flash no longer works in ordinary current browsers; Adobe ended Flash Player support at the end of 2020. Keep direct links beside important embeds and check periodically that the provider still serves them.

Key Takeaways

  • Loading third-party content contacts its provider even before playback.
  • A sandbox starts with restrictions; tokens restore selected capabilities.
  • Keep allow-scripts and allow-same-origin apart for same-origin content.
  • Use allow for needed browser features and referrer policy for the referring address.
  • Choose media elements for media files and iframes for separate pages.

HTML Forms examples

5 Walkthroughs

1

Build a workshop registration form

20 steps
Choose and connect controls, then follow the values a registration form will send.
  1. 1
    IntroductionStart with the answers you need

    A workshop registration needs a name, contact details, one session choice, optional interests, and a message. Each answer needs a suitable control and a label.

    Build the form in layers: decide where it sends data, choose the controls, then connect labels and instructions. You will check both what a visitor can enter and what reaches the receiving program.

  2. 2
    ExplanationChoose a destination and method

    Use <form action="/registrations" method="post"> to send a registration to the receiving URL. POST puts the answers in the request body and fits a submission that creates stored data.

    The connection still needs HTTPS for encryption. A method does not make the information private by itself, and the HTML does not store the registration; the receiving program does that.

  3. 3
    ExampleGive the answer a data key

    Start with <input id="attendee" name="attendee">. If the visitor enters "Nora", the control contributes attendee=Nora.

    The name tells the receiving program which answer it has. The id identifies the field on the page. Removing the name can leave a working-looking box that contributes nothing to the submission. A later label will connect through the id.

  4. 4
    ChallengePredict the outgoing fields

    A form has <input name="guest" value="Nora">, <input name="notes" value="">, and an unchecked checkbox named updates. Which fields contribute data?

    ---reveal---

    The text inputs contribute guest=Nora and notes=. The unchecked checkbox contributes no pair. An empty text value is different from an omitted checkbox: one names a field with no text; the other is absent from the submitted data.

  5. 5
    TipMake sending deliberate

    Add <button type="submit">Register</button>. A button inside a form defaults to submitting, so an explicit type makes the intention clear.

    If you later add a button for a scripted action, use type="button". A reset button restores initial values and can erase all the visitor’s typing. Pressing Enter in a single-line field can also trigger submission, so the form must work without relying on a mouse click.

  6. 6
    ExplanationChoose contact input types

    Use type="email" for the email address and type="tel" for an optional phone number. These types guide phone keyboards, but their checks differ.

    Email checks syntax, not whether the mailbox exists. Tel imposes no phone format. A password field hides on-screen characters but still needs HTTPS during submission. Pick types for the information they represent, not just the keyboard you want.

  7. 7
    ExampleKeep codes as text

    Suppose the workshop sends members a digit code. Use type="text" inputmode="numeric" for it. The keypad hint makes digits easy to enter without turning the code into a quantity.

    A number input can offer spin buttons and quantity-based behavior, which are unsuitable for an identifier. inputmode itself checks nothing; a fixed code format can receive a separate validation rule.

  8. 8
    ExplanationMake one session a radio group

    Offer three sessions with radio inputs that all use name="session". Give them values such as morning, afternoon, and evening.

    Choosing the afternoon button contributes session=afternoon and clears the previous choice in that group. Different names would allow several sessions to stay selected. Use separate checkboxes for independent interests, since visitors may want more than one.

  9. 9
    ChallengeRepair a single-choice group

    Two session radios use name="morning" value="morning" and name="afternoon" value="afternoon". A visitor can select both. What change makes them one group?

    ---reveal---

    Give both the same name, such as name="session", keeping their different values. Shared names establish the group; distinct values identify the chosen session. Making only their ids match would create duplicate page identities without fixing the grouping.

  10. 10
    Key InsightSeparate a displayed date from its value

    A date picker may show the same day in different orders on different devices. An input of type date still sends a fixed year-month-day value, such as 2026-11-18.

    The display follows the visitor’s locale; the request does not copy that display string. Date and time inputs do not supply a time zone. An appointment therefore needs enough visible context for the visitor to know which location’s time is intended.

  11. 11
    ExampleOffer a required fixed choice

    A long list of workshop locations suits a select. Give it an empty first option, such as <option value="">Choose a location</option>, and add required to the select.

    Each real option has its own submitted value. Choosing <option value="studio">Main studio</option> sends the stable key/value pair location=studio when the select is named location. The visible label can remain descriptive.

  12. 12
    ExampleLeave room for a message

    Add <textarea id="message" name="message" rows="5"></textarea> for a longer answer. Initial text belongs between its tags; the adjacent tags here keep the starting value empty.

    Rows control visible height, not the maximum answer length. A datalist serves a different task: link it through an input’s list to offer suggestions while permitting other answers. It cannot enforce the select’s fixed choices.

  13. 13
    ChallengeChoose between suggestions and fixed answers

    The workshop allows only its listed locations, but someone replaces the select with a text input linked to a datalist. Can the visitor now type an unlisted location?

    ---reveal---

    Yes. A datalist offers suggestions without restricting the answer. Keep a select when the permitted values are exactly the supplied choices. Use a datalist when another answer should remain possible, such as a city that is not among the common suggestions.

  14. 14
    ConnectionShow status without collecting an answer

    A progress bar can show how far registration processing has advanced. A meter can show a measurement within a known range, such as storage usage.

    Neither is an answer-entry control. Use <progress value="70" max="100">70%</progress> for task completion and give it explanatory text. For a group of independent optional interests, use checkboxes so visitors can actually change and submit their choices.

  15. 15
    ExampleConnect a visible label

    Write <label for="attendee">Name (required)</label> beside the input with id="attendee". The for value must match the id exactly, including case.

    Clicking the label should focus the input. Keep the label visible while typing; a placeholder cannot do that job. Required wording tells the user what is expected, while the required attribute makes the browser enforce presence.

  16. 16
    ExplanationGive the choices a shared question

    Wrap session radios in a fieldset whose first child is <legend>Session</legend>. Keep a separate label for each radio option.

    The legend explains the shared question; the labels name its answers. For contact fields, accurate autocomplete values such as name, email, and tel help the browser offer saved details. A nearby format hint can be linked through aria-describedby to the hint’s id.

  17. 17
    ChallengeFind the broken label connection

    The markup has <label for="contact">Email</label> and <input id="email" name="contact" type="email">. Why does clicking the label fail to focus that input?

    ---reveal---

    The for value matches the name but not the id. Change it to for="email" or choose a new matching unique id. The name already serves submission, so changing the label connection need not change the data key the receiving program expects.

  18. 18
    TipAdd an upload only with its encoding

    If registration needs a document, add a named type="file" input and set enctype="multipart/form-data" on the POST form. This encoding carries the file contents.

    An accept filter can guide the file chooser, but does not establish what the server will receive. Also remember that disabled controls are omitted, while supported read-only fields are sent. Use the attribute that matches the intended data behavior.

  19. 19
    ChallengeCheck the completed form

    A labeled location input offers only datalist suggestions, and the email input has an id but no name. The visitor must choose a listed location and the server needs the email. What two repairs are needed?

    ---reveal---

    Use a select for the fixed location choices and add a name to the email input. The select controls which choices are offered; the name gives the email a submitted key. A visible label alone fixes neither problem.

  20. 20
    RecapRead the form in two directions

    From the visitor’s side, check the control type, visible label, shared question, and instructions. From the server’s side, check the destination, method, names, and contributed values.

    Then click every label and move through the form with Tab. These checks catch different failures: a form can be easy to fill in yet omit data, or send correct data while being difficult to understand.

2

Debug a form’s validation rules

15 steps
Trace missing values, lengths, steps, and fixed formats before deciding why a submission passes or fails.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionFollow the checks that block sending
  2. 2
    ExplanationRequire a screen name
  3. 3
    ExampleTest presence and length separately
  4. 4
    ChallengeMake the field optional
  5. 5
    TipTest user entry, not just the default
  6. 6
    ExampleApply the range first
  7. 7
    ExampleCount from the actual base
  8. 8
    ChallengeSeparate step from maximum
  9. 9
    ConnectionRead time steps in seconds
  10. 10
    ExplanationMatch the organization’s fixed code
  11. 11
    ChallengeFind an ignored pattern
  12. 12
    TipExplain and show the error
  13. 13
    Key InsightA convenience check is not a trust boundary
  14. 14
    ChallengeDiagnose a mixed set of failures
  15. 15
    RecapUse a small boundary test list
3

Build and check a session timetable

11 steps
Create a readable table, then merge cells without breaking the grid or header relationships.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionPlan the table before its tags
  2. 2
    ExplanationName the table and its columns
  3. 3
    ExampleWrite one complete data row
  4. 4
    ChallengeRepair a visual-only heading
  5. 5
    TipKeep the meaning of empty cells clear
  6. 6
    ExampleMake one session last two rows
  7. 7
    ChallengeCount a row beneath a rowspan
  8. 8
    ExampleSpan lunch across both rooms
  9. 9
    ExplanationLink a cell to layered headers
  10. 10
    ChallengeFix alignment and meaning together
  11. 11
    RecapTrace a value through the table
4

Publish a short video with captions

17 steps
Build a native player, offer alternate files, and attach a working WebVTT caption track.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionPublish the information as well as the file
  2. 2
    ExampleReserve a player with controls
  3. 3
    ExplanationUse a loading hint deliberately
  4. 4
    ChallengeTurn a boolean setting off
  5. 5
    TipLet people pause automatic media
  6. 6
    ExplanationCheck container and codecs
  7. 7
    ExampleAdd a preferred source first
  8. 8
    ChallengeFind the unused alternatives
  9. 9
    Key InsightKeep a backup outside the player
  10. 10
    ExplanationChoose captions for sound information
  11. 11
    ExampleWrite the first cue
  12. 12
    ExampleAdd a meaningful sound cue
  13. 13
    ExampleAttach the file after the sources
  14. 14
    ChallengeConvert a timestamp correctly
  15. 15
    TipTest the track and the transcript
  16. 16
    ChallengeRepair two separate access failures
  17. 17
    RecapCheck the complete media route
5

Review a map and quiz embed

12 steps
Name and size a frame, choose loading behavior, and restrict it to the capabilities its content needs.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionTreat an embed as another document
  2. 2
    ExampleName the map before loading it
  3. 3
    ExplanationDelay a map below the main content
  4. 4
    TipInspect copied embed code
  5. 5
    ChallengeRecognize a server’s framing rule
  6. 6
    ExplanationBegin the quiz with restrictions
  7. 7
    Key InsightKeep origin and scripts under control
  8. 8
    ChallengeGrant the quiz only what it needs
  9. 9
    ConnectionSeparate privacy from a referrer header
  10. 10
    ExplanationChoose an element for the actual resource
  11. 11
    ChallengeReview a changed embed
  12. 12
    RecapReview the frame as a small dependency

HTML Forms practice questions

40 Practice Questions in 4 sets

Set 1: Collect and send the right answers10 Practice Questions

Question 1 of 10

A filled input has id="visitor" but no name. Why is its text absent from the submitted form data?
  1. The form needs POST to include any text input.
  2. The input needs a name to supply a data key.
  3. The input needs required to include its value.
  4. The id must match the receiving page address.
Show answerHide answer
Answer: B
The browser builds submitted data from named controls, so this input needs a name attribute. Its id identifies the element on the page and can connect a label, but does not supply a submission key. Changing the request from GET to POST would not make this unnamed control contribute its text.

Question 2 of 10

A site collects an equipment code such as "00482". What input setup fits that identifier while suggesting a digit keypad?
  1. type="number" step="1"
  2. type="range" min="0"
  3. type="tel" multiple
  4. type="text" inputmode="numeric"
Show answerHide answer
Answer: D
The equipment code is text identifying an item, so a text input preserves its role, including leading zeros. Numeric input mode suggests a digit keyboard without number-field behavior. A number field treats the entry as a quantity and can expose controls for increasing or decreasing it.

Question 3 of 10

The label uses for="address"; the email input uses id="email" name="address". What one change connects this label without changing the submitted data key?
  1. Change the label to for="email".
  2. Change the input to type="text".
  3. Change the input to name="email".
  4. Change the label to name="address".
Show answerHide answer
Answer: A
An explicit label connects through the control’s id, so for="email" creates the missing match. The name can stay address, preserving the key expected by the receiving program. Changing the name alone would leave the label pointing at an id that still does not exist.

Question 4 of 10

A delivery select is required and its first selected option is <option value="">Choose delivery</option>. What happens if the user submits without choosing another option?
  1. The visible prompt text is sent as the value.
  2. The browser sends the first nonempty option.
  3. The empty selection blocks normal submission.
  4. The select is omitted while the form is sent.
Show answerHide answer
Answer: C
The required single-choice select is invalid while its empty first option remains selected, so normal submission is blocked. The prompt text does not become the value because an explicit empty value was supplied. The browser does not silently choose another delivery method for the user.

Question 5 of 10

A GET form targets /lookup and contains a text input name="term" holding "css grid", an unchecked checkbox name="archived" value="yes", and a disabled input name="region" value="east". What request URL results?
  1. /lookup?term=css+grid&archived=no&region=east
  2. /lookup?term=css+grid
  3. /lookup?term=css+grid&archived=&region=
  4. /lookup?term=css+grid&region=east
Show answerHide answer
Answer: B
The named text input contributes its current value, with the space encoded as +. The unchecked checkbox and disabled input are both omitted, leaving only term=css+grid. A disabled value is not sent merely because it appears in the HTML, and an unchecked box does not create an automatic no value.

Question 6 of 10

Two radio buttons offer "Online" and "In person", but both remain checked. Their names are online and onsite. How should the grouping change?
  1. Give both one shared name and different values.
  2. Give both one shared id and different names.
  3. Give both required and keep different names.
  4. Give both one shared value and different names.
Show answerHide answer
Answer: A
Radio buttons belong to one choice group through a shared name. Give them the same name, such as attendance, and different values identifying the two modes. Required controls whether a group needs a selection; it does not merge separately named radios into one group.

Question 7 of 10

A city field offers common suggestions but must accept other typed cities. What control arrangement fits?
  1. A select containing the common city options.
  2. A radio group containing the common cities.
  3. An input linked to a datalist of suggestions.
  4. A text field with a pattern limited to the suggested cities.
Show answerHide answer
Answer: C
A datalist suggests values to a linked text input without limiting entry to the suggestions. That fits an open city question with some common answers. A select would restrict the ordinary choices to its options, so replacing the datalist with a select would change what visitors can enter.

Question 8 of 10

An optional text field has minlength="5". What happens to its length check when the user leaves it empty?
  1. It fails since zero is under five.
  2. It fails since minlength implies required.
  3. It measures the placeholder text instead.
  4. It passes because the field is empty.
Show answerHide answer
Answer: D
Minimum length does not reject an empty optional field, so this length check passes. Once the user enters text, the supplied value must meet the minimum. Required is a separate presence rule; add it when omission must also be blocked, instead of expecting minlength to require an answer.

Question 9 of 10

A document form uses GET with a named file input and default encoding. A helper button is also submitting the form. What pair of changes enables a normal file-content upload and makes the helper non-submitting?
  1. Use POST with multipart encoding; set helper type to button.
  2. Use POST with default encoding; set helper type to reset.
  3. Keep GET with multipart encoding; set helper type to button.
  4. Use POST with multipart encoding; remove helper type.
Show answerHide answer
Answer: A
A file-content upload needs POST and enctype="multipart/form-data", while a non-submitting helper needs type="button". These repair separate behaviors. POST with the default encoding still does not carry the file contents, and leaving the helper’s type absent retains its normal submit behavior inside a form.

Question 10 of 10

A text input contains required="false" minlength="3". The author wants it optional, with any entered answer at least three characters long. What should change?
  1. Remove minlength but keep required="false".
  2. Replace required with required="optional".
  3. Remove required and retain minlength="3".
  4. Replace minlength with maxlength="3".
Show answerHide answer
Answer: C
Remove required completely and keep the minimum length. Required is boolean: its presence enables the setting even when its value says "false". Keeping minlength then allows omission while still rejecting a supplied answer that is too short; changing it to maxlength would enforce a different rule.
Set 2: Check ranges, patterns, and table structure10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

What unit does step="300" use on an input of type time?
  1. Days
  2. Minutes
  3. Milliseconds
  4. Seconds
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A number field has min="2" max="14" step="4". What entered value passes all these constraints?
  1. 4
  2. 8
  3. 10
  4. 14.5
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A time field has min="08:20" max="10:20" step="1200". How many nonempty time values satisfy these settings?
  1. 7
  2. 6
  3. 8
  4. 9
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A required code uses pattern="[A-Z]{2}-[0-9]{3}". What entered code passes?
  1. "PZ-7314"
  2. "PZ-731"
  3. "PZ-73"
  4. "PZ731"
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

An email input is required and has an invalid pattern of "[". A user enters "ravi". What does normal submission do?
  1. It sends the value because the pattern is ignored.
  2. It sends the value because required is satisfied.
  3. It blocks only because the pattern is malformed.
  4. It blocks because the email syntax check still fails.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A table row lists one sensor’s temperature and humidity. What element should name that sensor at the start of the row?
  1. <td scope="row">
  2. <th scope="row">
  3. <th scope="col">
  4. <caption scope="row">
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A measurement table has headers "Sample", "Mass (kg)", and "Time (min)". One body row is <tr><th scope="row">B</th><td>18</td></tr>, intended to show an unavailable mass and a time of 18 minutes. How should the row be repaired?
  1. Put 18 in the first cell and remove the row header.
  2. Add colspan="2" to the cell containing 18.
  3. Insert a mass cell containing "n/a" before the 18 cell.
  4. Replace the time heading with an empty data cell.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A four-column table has headers "Time", "A", "B", and "C". In one row, a cell in A spans into the next row. That next row needs a time header and a shared B–C entry. What new cells should it contain?
  1. A time th and one td with colspan="2".
  2. A time th and one td with colspan="3".
  3. A time th and two td cells, each colspan="2".
  4. A time th, a blank td, and a colspan="2" td.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A silent looping clip has controls and muted="false". The author wants the initial muted setting off. What change does that?
  1. Add autoplay="false" to the video.
  2. Remove controls from the video.
  3. Set muted="off" on the video.
  4. Remove muted from the video.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

An MP3 file is offered as an audio source. What MIME type should its source declare?
  1. audio/mp3
  2. audio/mpeg
  3. video/mpeg
  4. audio/ogg
Show answerHide answer

Save this lesson to see this answer.

Set 3: Make media and embedded pages usable10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

What attribute makes the browser’s own playback controls visible on an audio element?
  1. controls
  2. poster
  3. preload
  4. playsinline
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A video lists WebM then MP4 child sources but also has its own src="preview.mp4". Why is the child order not deciding playback?
  1. MP4 files always override WebM in current browsers.
  2. The child sources need a shared name to form a list.
  3. The parent src takes precedence over child sources.
  4. The first source must repeat the parent’s file path.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A caption displays from 00:00:12.250 to 00:00:16.000. How long is that cue visible?
  1. 4.25 seconds
  2. 3.75 seconds
  3. 3.25 seconds
  4. 4.75 seconds
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A video lists child source files and a track on another origin. The video also has src="old.mp4". The track has valid WebVTT text, but its server sends no cross-origin permission and the video has no crossorigin setting. What complete repair enables the intended child-source selection and cross-origin track?
  1. Keep parent src; enable video crossorigin and server permission.
  2. Keep parent src; move the track before the child sources.
  3. Remove parent src; add default to the track without server changes.
  4. Remove parent src; enable video crossorigin and server permission.
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A browser supports video but cannot play the offered file. The video has its own src pointing to that file, plus a child source the browser can play. Its only download link is inside the video. What markup changes enable that alternative and a dependable visible backup?
  1. Remove parent src; keep a download link outside the video.
  2. Keep parent src; move the download link outside the video.
  3. Remove parent src; leave the download link only inside video.
  4. Keep parent src; place the child source after the inner link.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

An iframe holds a map of an event venue. What title best identifies its purpose for a screen-reader user?
  1. "Embedded content"
  2. "Map of the event venue"
  3. "Frame 1 on this page"
  4. "Map at 600 by 400 pixels"
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A framed quiz must execute scripts and submit its form while pop-ups stay blocked. What sandbox value fits those needs?
  1. allow-forms allow-popups
  2. allow-scripts allow-popups
  3. allow-scripts allow-forms
  4. allow-same-origin allow-forms
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

A same-origin preview frame runs untrusted HTML. It has sandbox="allow-scripts allow-same-origin", allow="camera", and referrerpolicy="no-referrer". The preview needs scripts but no camera. What permission changes restore useful isolation while retaining script execution?
  1. Remove camera; retain both sandbox tokens and no-referrer.
  2. Remove allow-scripts; retain camera and allow-same-origin.
  3. Remove no-referrer; retain camera and both sandbox tokens.
  4. Remove camera and allow-same-origin; retain allow-scripts.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A textarea has rows="4" cols="35" and no length attributes. Why can a visitor type more than 140 characters?
  1. Rows and cols set visible size, not entry length.
  2. Textareas always ignore every possible length rule.
  3. Cols counts words while rows counts paragraphs.
  4. The form’s method increases the text-entry limit.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A delivery fieldset has a legend but its radios have different names and no labels. A separate email field has an id and placeholder but no name. The page must permit one delivery choice, identify every control, and send the email. What repair covers all three needs?
  1. Share radio names; label radios and email; keep email unnamed.
  2. Share radio ids; label radios and email; add an email name.
  3. Share radio names; keep only the legend; add an email name.
  4. Share radio names; label radios and email; add an email name.
Show answerHide answer

Save this lesson to see this answer.

Set 4: Debug combined HTML problems10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A map far below the main content need not load until the visitor nears it. What iframe setting requests that behavior?
  1. loading="eager"
  2. preload="none"
  3. sandbox="lazy"
  4. loading="lazy"
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A number input has value="0.25", no min, and no step attribute. The user replaces its value. What entry meets the default step rule?
  1. 1.00
  2. 1.25
  3. 1.50
  4. 2.00
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A required text code must match [A-Z]{2}[0-9]{2}. The form has normal validation enabled. Its "Save draft" submit button has formnovalidate, while "Send" does not. The code is "xy8". What happens with each button?
  1. Both buttons block submission until the code matches.
  2. Send submits it; Save draft blocks the pattern mismatch.
  3. Save draft submits it; Send blocks the pattern mismatch.
  4. Both buttons submit because the code is nonempty.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A three-column table has a first-column header spanning two rows. In the second row, a td spans the remaining two columns. The td must refer to headers with ids r, planned, and actual. What second-row markup fits?
  1. <tr><td colspan="2" headers="r planned actual">12</td></tr>
  2. <tr><td></td><td colspan="2" headers="r planned actual">12</td></tr>
  3. <tr><td colspan="3" headers="r planned actual">12</td></tr>
  4. <tr><td colspan="2" headers="r,planned,actual">12</td></tr>
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A POST form has an input with name="member" value="K8" readonly, an empty named text field note, and an unchecked named checkbox copy. The request uses HTTPS. What data behavior should the receiving program expect?
  1. Only member arrives; HTTPS removes empty fields.
  2. Member, note, and copy arrive with their displayed values.
  3. Only note arrives; read-only values are omitted.
  4. Member and empty note arrive; copy is omitted.
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A video’s text track is intended to communicate both spoken instructions and an important alarm sound. What track kind identifies that purpose?
  1. captions
  2. subtitles
  3. chapters
  4. metadata
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A third-party player uses no-referrer and lazy loading below the page’s first screen. A visitor scrolls near it but never presses play. What happens when the iframe loads?
  1. The provider receives the full page path but no network address.
  2. No request is made because the visitor has not pressed play.
  3. The provider is contacted without the referring page address.
  4. No request is made because no-referrer blocks all contact.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

An optional nickname field has minlength="4". A user types three ordinary spaces. Does it pass the length rule, and why?
  1. Yes; optional fields skip every text-length constraint.
  2. No; the supplied value has fewer than four characters.
  3. No; spaces are always removed before length checking.
  4. Yes; spaces satisfy the minimum for any optional field.
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A table header says "Length (m)" and a data cell below it contains 2.4. What unit belongs to that value?
  1. Centimeters
  2. Millimeters
  3. Kilometers
  4. Meters
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A video has src="outdated.mov" plus child sources for unsupported WebM and supported MP4/H.264/AAC in that order. Its only download link is nested inside the player. What changes let this browser select the playable child file and keep a backup visible if playback still fails?
  1. Keep parent src, prefer WebM, and move the link outside.
  2. Remove parent src and put the download link outside.
  3. Remove parent src but keep the link only inside video.
  4. Keep parent src and replace source types with video/mp4.
Show answerHide answer

Save this lesson to see this answer.

Stuck on your own question? Homework Help

Key Terms

79 Key Terms, each with its definition

A

Accessible name
An accessible name identifies a control or frame to assistive technology so its purpose can be announced when a user reaches it.
The label "Phone number (optional)" tells a screen-reader user both the requested data and its optional status.
Action
The action attribute specifies the URL to which a form submits its data; omitting it targets the current page’s URL.
Setting action="/messages" directs a message submission to the site’s message-receiving address.
Aspect ratio
An aspect ratio is the relationship between an image or video’s width and height, used to keep its shape when its size changes.
A 1920 × 1080 clip has a 16:9 shape, so a matching player 640 pixels wide is 360 pixels high.
Audio description
An audio description narrates important visual details that a person needs to understand a video without seeing its images.
Description can explain a silent on-screen demonstration that the ordinary dialogue never mentions.
Autocomplete
Autocomplete is an attribute describing a field’s purpose so the browser can offer appropriate saved information for entry.
A phone field uses autocomplete="tel" so the browser can suggest the user’s saved telephone number.
Autoplay
Autoplay requests playback without a play-button press, but browsers may block it according to sound, interaction, and permission settings.
A muted inline background clip has a better chance of automatic playback than one that begins with sound.

B

Boolean attribute
A boolean attribute enables an HTML setting by being present; its written value does not turn the setting on or off.
An input with required="false" is still required, so the attribute must be removed to make it optional.

C

Caption
A caption is a table’s own title, placed first inside the table so readers can identify its subject before reading individual cells.
The caption "Running log, week 12" distinguishes that week’s measurements from another table on the page.
Captions
Captions represent speech, speaker identity, and meaningful sounds as timed text for people who cannot hear a recording’s audio.
A caption includes "[door closes]" so the sound’s information remains available with the player muted.
Checkbox
A checkbox is an independent checked-or-unchecked control whose value is submitted only when the box is checked.
A visitor can check both "Email updates" and "Event reminders" because the choices are independent.
Clickjacking
Clickjacking tricks a user into clicking a concealed or deceptive framed interface, which framing restrictions help sites prevent.
A site can refuse framing so its buttons cannot be hidden beneath a misleading interface on another page.
Codec
A codec encodes or decodes a media stream; a browser needs support for the actual video and audio codecs inside a container.
An MP4 can combine H.264 video with AAC audio, and both streams need suitable playback support.
Column group
A column group describes related table columns with colgroup, providing structure for group-level headers and certain column styles.
The columns "Planned" and "Actual" share a defined column group under the heading "Distance (km)".
Column span
A column span makes one table cell occupy several horizontal grid positions through its colspan attribute, replacing neighboring cells.
In a schedule with two day columns, a lunch entry with colspan="2" covers both beside the row’s separate time header.
Constraint validation
Constraint validation is the browser’s checking of form values against input types and attributes before a normal submission.
Submitting a form with an empty required email field focuses that field and shows a browser message.
Container
A container is the file structure holding media streams and related information, commonly identified by extensions such as .mp4 or .webm.
Two MP4 files may contain different encoded streams, so the extension alone does not guarantee playback.
Cue
A cue is one timed text entry with a start time, a later end time, and text to display during that interval in a WebVTT track.
The interval 00:00:01.000 --> 00:00:04.500 displays a cue for three and a half seconds.

D

Data cell
A data cell is a td element holding a table value whose meaning comes from the headers associated with its row and column.
In a table with a "Wednesday" row and a "Distance (km)" column, the value 7.5 is read as Wednesday’s distance in kilometers.
Data table
A data table organizes related values in rows and columns so each value gains meaning from both dimensions of the grid.
A running log compares distances and times for several days using one row per day and labeled columns.
Datalist
A datalist supplies suggested values to a linked input while leaving the user free to type an answer outside those suggestions.
A city field suggests "Osaka" and "Nairobi" but still accepts a different city entered by the visitor.
Described-by hint
A described-by hint is explanatory text linked to a control through aria-describedby, adding a description alongside its label.
A password hint with its own id explains "Use at least 8 characters" before the form is submitted.

F

Fallback content
Fallback content inside a media element is shown by browsers lacking that element, not as a general message for every playback failure.
A download link outside the player remains available even when a modern browser cannot play its sources.
Feature permission
A feature permission grants an embedded document access to a browser capability through allow, subject to other browser policy and user choices.
A player receives fullscreen permission without receiving unnecessary permission to use the visitor’s camera.
Fieldset
A fieldset groups related form controls, allowing a shared legend to name the group while individual controls retain their labels.
A fieldset places three delivery radio buttons together under the shared question "Delivery speed".
Form
A form is a group of controls that collects related input and sends the resulting data to a receiving URL as a request.
A contact form sends a visitor’s message and email address together when the visitor presses "Send".
Framing restriction
A framing restriction is a provider’s response rule that tells browsers where, or whether, its page may appear inside other pages.
A blocked frame needs an approved embed address or a direct link; changing its title cannot override the rule.

G

GET
GET is a request method that puts submitted form data in the URL query string and is suited to reading or searching information.
A catalog search can keep its search terms in the URL so the results address can be bookmarked.

H

Header abbreviation
A header abbreviation is shorter wording supplied by abbr on a header cell, which some screen readers use when repeating that header.
The long heading "Distance covered in kilometers" can supply abbr="Distance" for shorter repetition.
Header cell
A header cell is a th element that names a row or column and expresses a relationship to the table’s associated data cells.
The header "Distance (km)" identifies the quantity and unit shared by every measurement below it.
Header scope
A header scope states the direction or group to which a table header applies, such as across a row or down a column.
In a table of daily distances, each day name uses scope="row", while the distance heading uses scope="col" for the values below it.
Headers attribute
The headers attribute links a data cell to specific header cells through a space-separated list of their unique IDs.
A cell using headers="mon distance planned" points to three headings that jointly explain its value.

I

Inline frame
An inline frame is an iframe element that displays a separate web document inside the current page, with its own styles and scripts.
A venue page embeds a map service’s page while keeping the map inside a defined rectangular area.
Inline frame document
An inline frame document supplied with srcdoc is HTML written directly into the iframe attribute, taking precedence over a src URL.
A sandboxed message preview uses srcdoc="<p>Preview of your message</p>" without fetching a separate HTML page.
Input mode
An input mode is a hint for an on-screen keyboard layout; it does not validate the text or limit the characters a user can enter.
A membership-code text field uses inputmode="numeric" to make digit entry easier on a phone.
Input type
An input type is the setting that chooses a control’s entry behavior, such as an email field, a date picker, or a checkbox.
For an arrival date, type="date" supplies a picker instead of an unrestricted one-line text box.

L

Label
A label is text connected to a form control that supplies its accessible name and makes the text a clickable target for that control.
Clicking "Email address" focuses the field whose id matches the label’s for attribute.
Lazy loading
Lazy loading delays an iframe request until the frame is near the viewport, reducing the work needed for the page’s initial view.
A map far below the introduction uses loading="lazy" while the main top-of-page content loads promptly.
Legend
A legend is the first child element of a fieldset that names the group, giving its related controls a shared question or context.
The legend "Contact preferences" explains why several independently labeled communication checkboxes appear together.
Local date and time
A local date and time is a calendar date combined with a clock time, without a time zone, as collected by datetime-local.
An appointment entry can submit 2026-07-09T10:30; its location must supply any needed time-zone context.

M

Maximum
A maximum is an inclusive upper bound set by max that a numeric or date/time value must not exceed to pass validation.
A date field with max="2026-08-31" allows August 31 but rejects a later entered date.
Maximum length
A maximum length is the upper text-entry limit set by maxlength; browsers normally stop ordinary typing when this limit is reached.
A username field with maxlength="12" stops accepting a thirteenth ordinary Latin character during typing.
Meter
A meter displays a measurement within a known range, such as storage used, instead of showing completion of an ongoing task.
A meter with value="0.6" and its default range shows a measurement at 60% of that range.
MIME type
A MIME type identifies a resource’s format so a browser can decide whether it supports that resource before fetching media data.
An MP3 source declares type="audio/mpeg", allowing the browser to recognize its intended audio format.
Minimum
A minimum is an inclusive lower bound set by min for numeric or date/time input, also supplying the step base when valid.
With min="0.5" step="0.5", a parcel can weigh 0.5 kg and subsequent steps begin from that value.
Minimum length
A minimum length is a lower limit on entered text set by minlength, which still permits an empty field unless required also applies.
An optional nickname with minlength="4" may be omitted, but a supplied two-letter nickname fails.
Mixed content
Mixed content combines an HTTPS page with resources requested over HTTP; an HTTP iframe is blocked because it is active insecure content.
An HTTPS venue page that embeds a map must use the map’s HTTPS embed address to avoid a blocked insecure frame.
Multipart form data
Multipart form data is a form encoding that carries separate parts, including file contents, in a POST submission.
An upload form sets enctype="multipart/form-data" so the selected document’s bytes can be sent.

N

Name/value pair
A name/value pair links a submitted data key from a control’s name attribute to the value that control contributes.
A selected option can produce delivery=express, even when its visible label is "Express delivery".
Native controls
Native controls are the browser’s own playback interface, enabled by controls so visitors can start, pause, seek, and adjust media volume.
An audio element becomes a visible, usable player when the page adds the controls attribute.

O

Object fallback
An object fallback is content nested inside an object element to provide an alternative when the external resource cannot be displayed.
An embedded PDF object can contain a download link so readers can still obtain the document.
Option group
An option group is an optgroup element that places related select options under a named heading which cannot itself be selected.
The heading "Hot drinks" groups tea and coffee without becoming an orderable drink in the menu.
Origin
An origin is the combination of a web address’s scheme, host, and port, used by browser rules to distinguish document access boundaries.
An embedded page from the same HTTPS host and port can share an origin with the surrounding document.

P

Pattern
A pattern is an input attribute containing a regular expression that the whole nonempty value must match to pass its format check.
An organization can require a product code such as "ABC-1234" using its own fixed letter-and-digit pattern.
POST
POST is a request method that places submitted form data in the request body and is suited to sending messages or changing data.
A sign-up form uses POST, with HTTPS protecting the connection that carries the personal details.
Poster image
A poster image is a separate still picture displayed by a video element before playback, selected through its poster attribute.
A workshop video shows its introductory still while waiting for the visitor to press play.
Preload
Preload is a hint about fetching media before playback, requesting none, basic metadata, or potentially the full file.
A long clip uses preload="none" to avoid requesting its media in advance when many visitors may skip it.
Progress indicator
A progress indicator displays how much of a task is complete, using a progress element and its current value and maximum.
A task at 70 out of 100 can display a progress bar while its neighboring text names the task.

Q

Quantifier
A quantifier specifies how many times the preceding pattern item may repeat, such as exactly four times or between two and five times.
In [0-9]{4}, the quantifier requires four digits, so three digits do not complete the expected code.

R

Radio group
A radio group is a set of radio inputs sharing a name so that choosing one option clears any previous selection in that group.
Three delivery speeds use name="speed" together and distinct values to permit a single selection.
Range input
A range input is a slider for choosing a numeric setting within bounds, snapping to the increments defined by its step.
A volume slider can use min="0" max="10" when a rough setting is more useful than exact typing.
Referrer policy
A referrer policy controls how much of the referring page’s address is sent with a request; no-referrer omits that address entirely.
A frame with referrerpolicy="no-referrer" still contacts its provider but sends no referring page address.
Regular expression
A regular expression is a compact notation describing text patterns through character groups, repetition rules, and other operators.
The expression [A-Z]{3} accepts exactly three capital basic Latin letters when used as a whole-value pattern.
Required
Required is a boolean attribute that makes a supported control need a value or selection before it can pass validation.
The checkbox labeled "I accept the terms" must be checked when that checkbox carries required.
Row group
A row group collects table rows by role through thead, tbody, or tfoot, separating headings, main data, and summaries.
In a running log, the total distance and total time appear in a footer row inside tfoot after the body rows.
Row span
A row span makes a table cell occupy its column through several rows, so covered positions in later rows need no new cell.
A Monday session with rowspan="2" leaves the following row’s Monday position already occupied.

S

Sandbox
A sandbox applies restrictions to an iframe’s document, with specific tokens restoring selected abilities such as scripts or form submission.
A framed quiz permits scripts and forms while retaining the sandbox restriction that blocks pop-ups.
Select
A select is a control that offers a fixed set of options and submits the value of the selected option or options.
A delivery menu shows "Express (next day)" while submitting the shorter option value express.
Server validation
Server validation checks received data in the server program because a browser’s controls and checks can be changed or bypassed.
A server rejects a malformed product code even if someone removed the field’s pattern in developer tools.
Source element
A source element offers an alternative media file inside a player, allowing the browser to select the first playable source in order.
A video lists a WebM source before MP4 so WebM is preferred when the browser can play it.
Step
A step is an allowed increment from a field’s step base, restricting which values within its bounds pass validation.
A time field with step="900" uses 15-minute increments because time steps are measured in seconds.
Step base
A step base is the starting point for increments, taken from min, then a valid HTML value, then the input type’s default base.
A number field with min="1" step="2" allows 1, 3, and 5, so an in-range entry of 4 fails.
Step mismatch
A step mismatch occurs when an entered value does not lie a whole number of allowed steps away from the applicable base.
A mass of 2.25 kg fails a half-kilogram step starting at 0.5 even when it lies inside the field’s allowed range.
Subtitles
Subtitles transcribe or translate dialogue to help viewers understand spoken language while the audio itself is available to them.
A viewer who hears the original dialogue can use translated subtitles to follow its meaning.

T

Text area
A text area is a multiline text control whose initial value is written between its opening and closing textarea tags.
A message box sets rows="5" for visible height while maxlength separately limits the entered text.
Text track
A text track is timed information attached to media through track, with a kind such as captions, subtitles, chapters, or metadata.
A caption track supplies its language and a menu label so viewers can identify and enable the text.
Transcript
A transcript is a readable text version of speech and meaningful sounds, supplied on the page or through a clearly named nearby link.
A podcast page places "Read the episode transcript" directly below its audio player for easy access.

V

Validation bypass
A validation bypass skips the browser’s normal submission checks, using settings such as novalidate or a request sent outside the form.
A "Save draft" submit button can use formnovalidate while the normal "Send" button keeps checking.
Validation state
A validation state describes whether a control currently meets its constraints, which CSS can reflect with valid or invalid selectors.
The selector :user-invalid can delay error styling until the user has interacted with the control.

W

WebVTT
WebVTT is a UTF-8 text-track format beginning with WEBVTT and containing timed cues separated by blank lines, usually saved as .vtt.
A caption track points to intro.en.vtt, whose timestamps use periods before the millisecond digits.

About this lesson

By StudeliReport a mistake

Make your own Study Materials

Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.

Get Started