Tables

December 2016

Using Tables

Often, it is helpful to present information in a more structured manner than a list. Tables can display this information in rows and columns. The tables are defined as series of rows.

A table must follow the rules below:

  • The table is enclosed within the tags <TABLE> and </TABLE>.
  • The title of the table is enclosed within <CAPTION> </CAPTION>.
  • Each row is enclosed within <TR> </TR> (for Table Row).
  • The header cells are enclosed within <TH> </TH> (for Table Header).
  • The data in the each cell is enclosed within <TD> </TD> (Table Data).

Here is an example of an HTML table:

<TABLE BORDER="1">
<CAPTION>This is the title of the table</CAPTION>
<TR>
<TH> Title A1 </TH>
<TH> Title A2 </TH>
<TH> Title A3 </TH>
<TH> Title A4 </TH>
</TR>
<TR>
<TH> Title B1 </TH>
<TD> Value B2 </TD>
<TD> Value B3 </TD>
<TD> Value B4 </TD>
</TR>
</TABLE>

The results of this code:

This is the title of the table
Title A1 Title A2 Title A3 Title A4
Title B1 Value B2 Value B3 Value B4

Attributes

Attribute Tags it applies to Value Visual Effect
ALIGN THEAD
TBODY
TH
TR
TD
CENTER

LEFT

RIGHT

JUSTIFY

centred

Left

Right

Justified

CAPTION TOP

BOTTOM

Above

Below

VALIGN
(vertical alignment)
THEAD
TBODY
TH
TR
TD
TOP

MIDDLE

BOTTOM

Top

Middle

Bottom

BORDER=n TABLE   Border size
CELLPADDING=n TABLE   Leaves n pixels of space between cell contents and border
CELLSPACING=n TABLE   Thickness of the space in between cells
FLOAT TABLE RIGHT

LEFT

Position of text that follows </TABLE>
COLS=n TABLE   Number of columns
FRAME

(controls individual table frame elements)

TABLE NONE

top

BOTTOM

TOPBOT

SIDES

ALL

None

Above

Bottom

All on top

On the sides

All

RULES

(controls cell grid elements)

TABLE NONE

BASIC

ROWS

COLS

ALL

None

basic

Line

Column

All

COLSPAN THEAD
TBODY
TH
TR
TD
  Makes cells fill multiple adjacent columns
ROWSPAN THEAD
TBODY
TH
TR
TD
  Makes cells fill multiple adjacent rows

Related :


Tablas
Tablas
Tableau HTML (TABLE)
Tableau HTML (TABLE)
Le tabelle
Le tabelle
Os quadros
Os quadros
ASCII
ASCII
This document entitled « Tables » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.