concept

Table cell spanning — CSS reference

HTML colspan and rowspan establish how many grid columns or rows a cell occupies. CSS width alone does not define spanning. In a fixed-width table with two equal columns, a colspan=2 cell covers both; spacing and borders also affect its geometry.

Formal Syntax & Structure

css syntaxcss
<td colspan="2">Total</td>

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>Table cell spanning</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{width:200px;table-layout:fixed}td{height:30px}</style><body><table id="a"><tr><td id="x">A</td><td id="y">B</td></tr><tr><td id="z" colspan="2">Total</td></tr></table></body></html>
CSS Reference