Tables and blocks: caption, tfoot, time, data, address and marquee

Five ideas from the element catalogue about elements that carry a fact: the caption and the footer of a table, the machine form of a date or a number, a postal address, and a line of links that scrolls. In each demo the element stays in the document with its own text, and the canvas draws it somewhere else or draws around it.

Caption as a rubber stamp

An invoice whose <caption> says that it's paid. Press the button: the caption leaves its place above the rows and comes down across them, turned, larger and red, inside a frame.

Paid in full
Invoice 1042Amount
Hull survey£180.00
Two coats of varnish£96.50
New mooring line£41.20
Winter storage£260.00

A <caption> isn't drawable by itself. It's a box inside the picture of the table, as wide as the table, so the stamp is a draw of the table clipped to the box of the words. A ctx.filter on that draw turns them red.

Show the code
  1. A table with a caption. The table is the drawable element.
  2. Draw the rows, then the caption's words turned and enlarged.
  3. Place the table, and draw one box of it somewhere else.
  4. Styles.

Footer totals that count up

A basket. Change a quantity with the buttons or type one. The total in the <tfoot> counts to its new value over 0.6 seconds, and while it counts the footer row is drawn lifted and larger, with two faint copies of itself trailing behind.

ItemEachQuantity
Loaf£3.20
Cheese£12.75
Apple£0.85
Total

The number that counts is the text of the footer cell, written on every frame, so a screen reader and a copy of the table get the same value as the eye. The lift and the copies are three clipped draws of the table at the box of its <tfoot>.

Show the code
  1. The table, with real inputs and buttons in its cells.
  2. Write the cell on each frame, and draw the footer row as its own piece.

Machine values next to shown values

A notice with two <time> and two <data> elements, which have a dotted line under them. Hold the button, or the M key: the datetime or value attribute of each is drawn in a tag above it.

The ferry leaves and takes . A return is thirty-eight pounds fifty and the boat carries twelve score people.

The attributes aren't in the picture of the paragraph. The canvas reads them from the elements and draws them as its own text, placed from each element's first client rectangle.

Show the code
  1. The paragraph.
  2. Draw each attribute in a tag above its element.

Address on an envelope

Type a name, a street and a town. The script writes them into an <address> element, and the canvas draws that element on an envelope. Press the button: the flap closes, the envelope leaves and an empty one arrives.

The address on the envelope is the element, not a copy: each key press in a field changes its text, the browser raises paint, and the envelope is drawn again. The form is drawn flat under the envelope, so its fields take input where they are seen.

Show the code
  1. An <address> and a form, both drawable.
  2. Draw the envelope, the address on it, the flap and the form.

Stock ticker with real links

A <marquee> with six links in it, drawn as a board of lit dots with a reflection under it. The marquee scrolls by itself. Tap a symbol while it moves.

CAPT 104.20 ▲1.4%TFOOT 61.85 ▼0.6%TIME 07.40 ▲2.2%DATA 38.50 ▲0.3%ADDR 51.00 ▼1.1%MARQ 60.00 ▲3.0%

There's no frame loop in this demo. Each step of the marquee raises a paint event that names it, and the board is drawn then. The links are hit-tested by the browser at the place where they are at that moment.

Show the code
  1. A drawable marquee of links.
  2. Draw the board on each paint event the marquee raises.
  3. A paint handler with no frame loop.

How it works

Show the code
  1. Place a block, and draw one piece of it.
  2. Each demo starts when its section comes near the screen.
  3. The paint handler of the first four canvases.
  4. After a lost context the elements are shown as plain HTML.

Live checks

The checks wait for a tap. Each builds its own small canvas in a corner of the window, and none of them touches the demos above.

Findings

Measured in headless Chromium 157 on 2026-11-21. Not yet run on a phone.