This group of attributes contains only those used for HTML table styling.

Related elements:

frame attribute:

TABLE

rules attribute:

TABLE

border attribute:

TABLE

cellspacing attribute:

TABLE

cellpadding attribute:

TABLE

align attribute:

COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, TR

valign attribute:

COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, TR

char attribute:

COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, TR

charoff attribute:

COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, TR

span attribute:

COL, COLGROUP

rowspan attribute:

TD, TH

colspan attribute:

TD, TH

Attribute characteristics and purpose:

frame attribute:

  • specifies which side of the frame surrounding table will be visible
  • possible values: void (no sides, default), above (top), below (bottom), hsides (top, bottom), vsides (left, right), lhs (left), rhs (right), box (all), border (all)

rules attribute:

  • specifies which rules will show between cells
  • possible values: none (default), groups (between row groups (<thead>, <tbody>, <tfoot>) and column groups (<colgroup>, <col>)), rows, cols, all

border attribute:

  • defines the width (pixels) of the frame around the table

cellspacing attribute:

  • specifies the space between cells

cellpadding attribute:

  • specifies the space between cell border and its content

align attribute:

  • specifies table's data alignment and text justification
  • values are: left (default), center, right, justify and char (aligns text around specific character)
  • align attribute used to be widely used for many other elements but have been deprecated and replaced with style sheets

valign attribute:

  • specifies vertical alignment of data in a cell
  • possible values: top, middle (default), bottom, baseline (all text lines of cells in same row appear on the same baseline declared in one of them)

char attribute:

  • specifies a single character that should be the axis for alignment; align attribute must be set to "char" value

charoff attribute:

  • defines the offset to the first occurrence of the mentioned aligning character; align attribute must be set to "char" value and if char attribute is missing it should be horizontally shifted to the end
  • direction of offset is determined by the dir attribute

span attribute:

  • specifies the number of columns spanned by <col /> element
  • must be set to more then "0" (default is "1")
  • <col /> element attribute should override <column> element

rowspan attribute:

  • number of rows spanned by the current cell
  • default value is "1"; value of "0" means that the cell spans across all rows

colspan attribute:

  • number of columns spanned by the current cell
  • default value is "1"; value of "0" means that the cell spans across all columns

Example

HTML table styling attributes

 

›› go to examples ››