jump

HTML: The Markup Language Reference

tabletable # T

The table element represents a table; that is, data with more than one dimension.

Permitted contents #

an optional caption element, followed by zero or more colgroup elements, followed by an optional thead element, followed by one tfoot element, followed by zero or more tbody elements, or one or more tr elements or zero or more tbody elements, or one or more tr elements followed by an optional tfoot element

Permitted attributes #

global attributes
Any attributes permitted globally.
summary = string #
A prose description of the structure of the table.

Additional constraints and admonitions #

Tag omission #

A table element must have both a start tag and an end tag.

Permitted parent elements #

any element that can contain flow elements

Details #

Although in previous versions of HTML a table element was only allowed to contain a tfoot element if that tfoot occurred before any tbody or tr elements, but not after, the table element is now also alternatively allowed to contain a tfoot after any tbody or tr elements.

DOM interface #

interface HTMLTableElement : HTMLElement {
           attribute HTMLTableCaptionElement caption;
  HTMLElement createCaption();
  void deleteCaption();
           attribute HTMLTableSectionElement tHead;
  HTMLElement createTHead();
  void deleteTHead();
           attribute HTMLTableSectionElement tFoot;
  HTMLElement createTFoot();
  void deleteTFoot();
  readonly attribute HTMLCollection tBodies;
  HTMLElement createTBody();
  readonly attribute HTMLCollection rows;
  HTMLElement insertRow(in optional long index);
  void deleteRow(in long index);
           attribute DOMString summary;
};

Typical default display properties #

table {
display: table;
border-collapse: separate;
border-spacing: 2px;
border-color: gray; }