jump

HTML: The Markup Language

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.
border = string #
Indicates that its table element is not being used for layout purposes.

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 border;
};

Typical default display properties #

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