HTML Table Attributes: Comprehensive Reference

Classified in Arts and Humanities

Written at on English with a size of 2.47 KB.

HTML Table Attributes Reference

This document provides a reference for HTML table attributes.

Table Attributes

The following attributes can be used with the <table> element:

  • border: Specifies the width of the table border.
  • bordercolor: Specifies the color of the table border.
  • bordercolorlight: Specifies the light color of the table border.
  • bordercolordark: Specifies the dark color of the table border.
  • height: Specifies the height of the table.
  • width: Specifies the width of the table.
  • cellspacing: Specifies the space between table cells.
  • cellpadding: Specifies the space between the cell border and its content.
  • align: Specifies the alignment of the table (CENTER, LEFT, RIGHT).
  • bgcolor: Specifies the background color of the table.
  • background: Specifies a background image for the table.

Table Row Attributes

The following attributes can be used with the <tr> element:

  • align: Specifies the horizontal alignment of content within the row (CENTER, LEFT, RIGHT, JUSTIFY).
  • valign: Specifies the vertical alignment of content within the row (TOP, MIDDLE, BOTTOM, JUSTIFY).

Table Data and Header Cell Attributes

The following attributes can be used with the <td> (table data) and <th> (table header) elements:

  • height: Specifies the height of the cell.
  • width: Specifies the width of the cell.
  • align: Specifies the horizontal alignment of content within the cell (CENTER, LEFT, RIGHT, JUSTIFY).
  • valign: Specifies the vertical alignment of content within the cell (TOP, MIDDLE, BOTTOM, JUSTIFY).
  • rowspan: Specifies the number of rows a cell should span.
  • colspan: Specifies the number of columns a cell should span.

Example of using an image in a table cell:

<td><img src="URL"></td>

Entradas relacionadas: