Quantcast
Channel:
Viewing all articles
Browse latest Browse all 11

Column Tag

$
0
0

The <col> element sets attributes that will be used for all cells in a table column. <col> is very useful for defining what a column will look like without defining each cell individually, and can only be used within tables. <col> is valid in all browsers, but since most attributes have limited support, it is best to use CSS to define how the column will look.

Attributes:

  • align: Sets the alignment of the content within the column. Possible values are left, right, center, justify, char. This attribute is only valid in IE and Opera. IE does not recognize justify.
  • char: Sets the character to align on if the char align option is used. char is not recognized by any major browser. The default is a decimal point.
  • charoff: Sets the number of characters the content will be aligned from the character specified by the char attribute. The charoff attribute is not supported in any major browser.
  • span: Sets the number of columns the column should span. Not supported in Firefox.
  • valign: Sets the vertical alignment of the column. Options are middle, bottom, baseline. Not supported in Firefox.
  • width: Sets the width of the column. Can be set in percents, pixels, or relative length. Valid in all major browsers.

Example
<table border="1" width="100%">
<col width="50%" />
<col width="50%" />
<tr>
<th>Head 1</th>
<th>Head 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>More data</td>
</tr>
</table>


Head 1Head 2
Data 1More data

Viewing all articles
Browse latest Browse all 11

Trending Articles