property

Table layout — CSS reference

Selects the table width algorithm. With an explicit table width, fixed layout can establish columns from column declarations and the first row instead of measuring later cell contents. Auto layout takes intrinsic content sizes into account. A long word may overflow a fixed-width cell, so choose wrapping or overflow handling deliberately.

Formal Syntax & Structure

css syntaxcss
table-layout: auto | fixed;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>table-layout</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}body{font:16px/20px sans-serif;background:white}#a{padding:0;background:transparent;margin:10px;color:black}table{border-spacing:0}td,th{padding:0}caption{padding:0}#a{table-layout:fixed;width:240px}td{height:30px}#x{width:80px}</style><body><table id="a"><tr><td id="x">A</td><td id="y">B</td></tr><tr><td id="z">C</td><td>D</td></tr></table></body></html>
CSS Reference