Tsallaka zuwa abun ciki
Justice Tech School

Table Alignment and Cell Sizing

Use text-align, vertical-align and width on cells. Avoid the old align and valign attributes. colspan and rowspan merge cells.

Example
<style>td, th { border: 1px solid #64748b; padding: 6px } table { border-collapse: collapse }</style>
<table><tr><th colspan="2">Merged heading</th></tr><tr><td style="text-align:right">Right</td><td style="vertical-align:top;height:50px">Top</td></tr></table>

Exercise

Merge two columns.

<th ="2">

Quiz Test

What does rowspan do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.