# DITA Best Practices : Tables Overview

Created by Todd Stupnik, last modified on Dec 22, 2014

This article presents a high-level overview of tables.

The <table> element organizes arbitrarily complex relationships of tabular information. This standard table markup allows column or row spanning and table captions or descriptions. An optional title allowed inside the table element provides a caption to describe the table.

The DITA table is based on the OASIS Exchange Table Model, augmented with DITA attributes which enable it for specialization, conref, and other DITA processing. In addition, the table includes a desc element, which enables table description that is parallel with figure description.

In DITA tables, in place of the expanse attribute used by other DITA elements, the pgwide attribute is used instead, to conform with the OASIS Exchange Table Model. This attribute has a similar semantic (1=page width; 0=resize to galley or column).

Note: The scale attribute represents a stylistic markup property that is maintained for now in tables for legacy purposes. External stylesheets should enable less dependency on this attribute. You should use the scale attribute judiciously in your topics.

The table consists of the following:

table: use the <table> element to create a complex table. Complex tables provide you with control over the display properties and layout of the table. The <table> element is the container for all of the complext table elements.

tgroup: use the <tgroup> element to specify the display properties for the columns, rows, spanning, header, footer, and body of the complex table. The <tgroup> element with column specifications is required when using a complex table.

colspec: (column specification) Use the <colspec> element to specify the column information, such as column name, number, cell content alignment, and column width. The column name, number, cell content alignment and column width are all specified using attributes in the <colspec> element. Use the colname attribute to specify the column name. Use the cols attribute to specify the number of columns. Use the align attribute to align the cell content. Use the colwidth attribute to specify the width of each column.

thead: (table head) Use the <thead> element to define the heads for the table columns. The <thead> element is used in the <table> container. It contains multiple <row> and <entry> elements.

tbody: (rows/entries) Use the <tbody> element to define the body of the table. The <tbody> element is the container for multiple <row> and <entry> elements.

<row>: Use the <row> element to define a single row in the table. Each <row> element contains multiple <entry> elements, each indicating a different columns. The number of <entry> elements in the body of the table should match the number of <entry> elements in the <thead> element.

<entry>: (entry) Use the <entry> element to define a single cell in the table. The number of <entry> elements defined in the <tbody> element must match the element of <entry> elements defined in the <thead> element.

## Example