|
LILLY ROBOT |
| Property | Value |
|---|---|
| border-collapse | collapse, separate |
| border-spacing | length e.g 20px |
| caption-side | top, bottom, left, right |
| empty cells | show, hide |
| table-layout | auto, fixed |
It is important to understand the structure of the table tags before we look at any of the properties.
Example
| table header | table header |
|---|---|
| table data | table data |
| table data | table data |
A table border can be seperated or collapsed (single border).
Displays
| Name | Results |
|---|---|
| Jane | passed |
| Imran | passed |
| Tom | passed |
Displays
| Name | Results |
|---|---|
| Jane | passed |
| Imran | passed |
| Tom | passed |
A border spacing specifies the distance that separates the borders of adjoining cells.
Displays
| Name | Results |
|---|---|
| Jane | passed |
| Imran | passed |
| Tom | passed |
A table caption is a title, it tells you what the table is about. The placement of the table caption can be on the top, bottom, left or right.
Displays
| Name | Results |
|---|---|
| Jane | passed |
| Imran | passed |
| Tom | passed |
Cells without content can have their borders hidden. In the table below we have removed the content Jane and passed.
Displays
| Name | Results |
|---|---|
| Imran | passed |
| Tom | passed |
Displays
| Name | Results |
|---|---|
| Imran | passed |
| Tom | passed |
The default algorithm for the table layout, by most browsers, is automatic. The auto value takes into consideration the content inside the table cells when defining the widths of the cells layout.
Whereas, if the table layout value is fixed the content is ignored, instead it is based on the first width of the table's cell.
Table Layout: Fixed
<table style="table-layout:fixed; width:100%">
<th style="width:20%">Name</th>
Table Layout: Auto
<table style="table-layout:auto; width:100%">
<th style="width:20%">Name</th>
Displays
| Name | Results |
|---|---|
| Jane | passed |
| Imran | passed |
| Tom | passed |
Displays
| Name | Results |
|---|---|
| Jane | passed |
| Imran | passed |
| Tom | passed |