A cell's margin, border, inner space and background

What a cell can do with its own box: the margin, the border, the space inside, the background.

A cell has a box of its own, and this page takes it apart: the margin that holds its neighbours off, the border it can paint on any of its four sides, the space inside that keeps its text off that border, and the colour behind all of it.

The table declares no separating line of its own here, so every line on the page is drawn by the cell it belongs to. That is the whole point of a cell border: it belongs to the cell rather than to the grid, so a single cell can carry a line on one side only — which is how a totals row gets its line without one being drawn anywhere else.

What this example shows

  • Margin, border, inner space and background, each shown on its own.
  • A border on one side of one cell, with no grid lines at all.
  • The four sides settable one at a time.

The code, in full

The same document is written twice, once in each language. Both files are shown in full, with the code coloured on the server, and can be copied in one click.

The document itself

The same document is written in each of these languages. Open the one you want to look at.

Open the document in English Open the document in French

Read the Rust source Read the Python source

First page of A cell's margin, border, inner space and background

What this document weighs

Before 109,685 bytes
Now 39,067 bytes
Saved 64.4 %

Not one mark on the page changed. See every document measured.

Examples near this one

A self-paginating table

A long table handed over whole, deciding for itself where the pages break: its heading on top of every page, its footnote under every page, its grey grounds stated once for the whole table, and a note you draw under each page at the exact place the table reports.

Cells merged down the rows

A specification sheet whose cells are merged down the rows: each group named once beside all of its rows, with one note beside them; the thin lines stop at those cells' edges, and a note too long for the rows it covers makes them grow.

Columns measured from their cells

One parts list twice: four columns sharing the width equally, then the reference, the quantity and the price each as wide as their own widest cell and the description given everything they leave.

Pictures inside table cells

A catalogue whose first column is a picture rather than text: four pictures of very different sizes and proportions, each fitted whole and undistorted into the cell the table gives it and standing against a different corner of it, claiming no width from its column and no height from its row.

Every example, by subject