Working Draft · css-tables

CSS Table

5 properties defined by this specification, all known to at least one browser .

Each feature in detail

border-collapse

Property Baseline: widely availablesince January 2018

MDN The border-collapse CSS property sets whether cells inside a <table> have shared or separate borders.

Live preview Example from MDN
table {
  width: 15rem;
  table-layout: fixed;
}

td {
  border: 5px solid;
  border-color: crimson dodgerblue orange limegreen;
  padding: 0.75rem;
}

Syntax

separate | collapse

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
separate
Applies to
table grid boxes
Inherited
yes
Percentages
n/a
Computed value
specified keyword
Canonical order
per grammar
Animation type
discrete

Browser support

First browser version supporting border-collapse
Chrome 1
Edge 12
Firefox 1
Safari 1.1
Chrome Android 18
Safari iOS 1

First version with support, from MDN browser-compat-data.

border-spacing

Property Baseline: widely availablesince January 2018

MDN The border-spacing CSS property sets the distance between the borders of adjacent cells in a <table>. This property applies only when border-collapse is separate.

Live preview Example from MDN
table {
  width: 15rem;
  table-layout: fixed;
}

td {
  border: 5px solid;
  border-color: crimson dodgerblue;
  padding: 0.75rem;
}

Syntax

<length [0,∞]>{1,2}

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
0px 0px
Applies to
table grid boxes when border-collapse is separate
Inherited
yes
Percentages
n/a
Computed value
two absolute lengths
Canonical order
per grammar
Animation type
by computed value

Browser support

First browser version supporting border-spacing
Chrome 1
Edge 12
Firefox 1
Safari 1
Chrome Android 18
Safari iOS 1

First version with support, from MDN browser-compat-data.

caption-side

Property Baseline: widely availablesince January 2018

MDN The caption-side CSS property puts the content of a table's <caption> on the specified side. The values are relative to the writing-mode of the table.

Live preview Example from MDN
table {
  font-size: 1.2rem;
  text-align: left;
  color: black;
}

th,
td {
  padding: 0.2rem 1rem;
}

caption {
  background: #ffcc33;
  padding: 0.5rem 1rem;
}

tr {
  background: #eeeeee;
}

tr:nth-child(even) {
  background: #cccccc;
}

Syntax

top | bottom

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
top
Applies to
table-caption boxes
Inherited
yes
Percentages
n/a
Computed value
specified keyword
Canonical order
per grammar
Animation type
discrete

Browser support

First browser version supporting caption-side
Chrome 1
Edge 12
Firefox 1
Safari 1
Chrome Android 18
Safari iOS 1

First version with support, from MDN browser-compat-data.

empty-cells

Property Baseline: widely availablesince January 2018

MDN The empty-cells CSS property sets whether borders and backgrounds appear around <table> cells that have no visible content.

Live preview Example from MDN
th,
td {
  border: 2px solid #aa1199;
  padding: 0.25rem 0.5rem;
}

Syntax

show | hide

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
show
Applies to
table-cell boxes
Inherited
yes
Percentages
n/a
Computed value
specified keyword
Canonical order
per grammar
Animation type
discrete

Browser support

First browser version supporting empty-cells
Chrome 1
Edge 12
Firefox 1
Safari 1.2
Chrome Android 18
Safari iOS 1

First version with support, from MDN browser-compat-data.

table-layout

Property Baseline: widely availablesince January 2018

MDN The table-layout CSS property sets the algorithm used to lay out <table> cells, rows, and columns.

Live preview Example from MDN
table {
  border: 1px solid #113399;
}

th,
td {
  border: 2px solid #aa1199;
  padding: 0.25rem 0.5rem;
}

Syntax

auto | fixed

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Definition

Initial
auto
Applies to
table grid boxes
Inherited
no
Percentages
n/a
Computed value
specified keyword
Canonical order
per grammar
Animation type
discrete

Browser support

First browser version supporting table-layout
Chrome 14
Edge 12
Firefox 1
Safari 1
Chrome Android 18
Safari iOS 3

First version with support, from MDN browser-compat-data.