Glubase - share your knowledge


All / Computers / Programming / CSS





  • View Command

CSS Reference

CSS table-layout definition

Browser support
IEFFOpSaf

Type:

Syntax

table-layout: [auto | fixed];

Description

The table-layout property defines the algorithm used to display the table cells, rows, and columns.

Values

Values Description
auto This value makes the cells in a table resize according to the contents of the cells instead of the width of the columns/table. This is the default value.
fixed This value will set the cell size to a fixed value defined by the width property in the columns/table.

Version information

Available in CSS2

Example

[Try this example yourself]
<style type="text/css">
table.automatic
{
  table-layout: automatic
}
table.fixed
{
  table-layout: fixed
}
</style>

<table class="automatic" width="100%">
  <tr>
    <td width="20%">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</td>
    <td width="40%">XXXXXXXXXXXXXXX</td>
    <td width="40%">XXXXXXXXXXXXXXX</td>
  </tr>
</table>

<br />

<table class="fixed" width="100%">
  <tr>
    <td width="20%">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</td>
    <td width="40%">XXXXXXXXXXXXXXX</td>
    <td width="40%">XXXXXXXXXXXXXXX</td>
  </tr>
</table>

Output

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX
  • Comments

No comments added.