HTML table
A table is a set of rows (tr tag) with inside a set of a columns (td tag). You can set the table size and/or the columns size using the width attribute.
Changing the td tag by the th tag if for the table header part.
Usual attributes
Attribute name | Attribute value |
---|---|
align | Align the table related the current content. It can be left, right or center. When using related a td or a th tags it will align the content. |
border | Specify the border width around each table cell. By default there's no border |
cellspacing | Specify the spacing between the table cells |
class | Set a value for CSS rules. The CSS rule will be applied to all tags with the same class name |
colspan | Specify the number of columns that should be spanned. It applied on the td, th tags. |
id | Set a unique value, it is useful for JavaScript or for CSS rule. For CSS it will be applied only for this tag |
rowspan | Specify the number of rows that should be spanned. It applied on the tr tag. |
style | Set a CSS value. It has always priority for general CSS rules. Sample : "background-color:red;color:white" |
valign | Vertical alignment of the cell content : top, middle, bottom, baseline |
width |
- Specify the width of the table related the surrounding width. 100% means the table will take the maximum of space
- Specify the width of a column related the table width. It applies on the td or th tags
|