The table-layout CSS property sets the algorithm used to lay out <table> cells, rows, and columns. /* Keyword values */
table-layout: auto;
table-layout: fixed;
/* Global values */
table-layout: inherit;
table-layout: initial;
table-layout: revert;
table-layout: revert-layer;
table-layout: unset;
auto By default, most browsers use an automatic table layout algorithm. The widths of the table
and its cells are adjusted to fit the content. Table and column widths are set by the widths of table and col elements or by the width of the first row of cells. Cells in subsequent rows do not affect column widths. Under the "fixed" layout method, the entire table can be rendered once the first table row has been downloaded and analyzed. This can speed up rendering time over the "automatic" layout method, but subsequent cell content might
not fit in the column widths provided. Cells use the overflow property to determine whether to clip any overflowing content, but only if the table has a known width; otherwise, they won't overflow the cells. table-layout =
This example uses a fixed table layout, combined with the width property, to restrict the table's width. The text-overflow property is used to apply an ellipsis to words that are too long to fit. If the table layout were auto, the table would grow to accommodate its contents, despite the specified width. <table>
<tr>
<td>Ed</td>
<td>Wood</td>
</tr>
<tr>
<td>Albert</td>
<td>Schweitzer</td>
</tr>
<tr>
<td>Jane</td>
<td>Fonda</td>
</tr>
<tr>
<td>William</td>
<td>Shakespeare</td>
</tr>
</table>
Try it
Syntax
Values
Formal definition
Formal syntax
auto |
fixed Examples
Fixed-width tables with text-overflow
HTML
CSS
table { table-layout: fixed; width: 120px; border: 1px solid red; } td { border: 1px solid blue; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
Result
Specifications
Unknown specification # width-layout |
Browser compatibility
BCD tables only load in the browser
See also
You can resize the width of table cells and columns, as well as change the height of table rows.
You can also distribute rows and columns evenly using the icons on the toolbar on the Bar.
Changing the Width of Columns and Cells
To Change the Width of a Column
Do one of the following:
Rest the mouse pointer over the column dividing line until the pointer becomes a separator icon, and then drag the line to a new location.
Rest the mouse pointer over the column dividing line on the ruler until the pointer becomes a separator icon, and then drag the line to a new location.
Hold down and then click and drag a line to scale all cells right or above the line proportionally.
Place the cursor in a cell in the column, hold down the key, and then press the left or the right arrow key.
To increase the distance from the left edge of the page to the edge of the table, hold down +Shift, and then press the right arrow key.
You can specify the behavior for the arrow keys by choosing - LibreOffice Writer - Table, and selecting the options that you want in the Keyboard handling area.
To Change the Width of a Cell
Hold down , and then press the left or the right arrow key
Changing the Height of a Row
To change the height of a row, place the cursor in a cell in the row, hold down the key, and then press the up or the down arrow key.
Resizing a Whole Table
To change the width and height of a table, do one of the following:
Click inside the table. In the rulers, drag the border between the white and the gray area to resize the table.
Click inside the table. Choose to open a dialog and set the properties to the numbers.
To wrap text to the sides of a table, and to arrange two tables next to another, you must insert the tables into a frame. Click inside the table, press +A twice to select the whole table, then choose Insert - Frame.
Tables within HTML pages do not offer the full range of properties and commands as tables in OpenDocument format.