Share this Page URL

Creating a Two-Column Table Layout > Using Background Images in Page Layouts - Pg. 173

170 Learn HTML 4 In a Weekend Spanning Columns and Rows Creating cells that can span columns or rows (or both) can provide you with many more options for the kinds of table designs you can create. Spanning Table Columns The COLSPAN attribute can be used in the TH or TD elements to create a table cell that spans multiple columns. Add a new row to the table that includes three cells, with the middle cell spanning three cells (see Figure 5.18): <caption style="margin-bottom: 24px">Table I. First Quarter Sales Results</caption> <tr><th></th><th colspan="3">First Quarter Sales Report</th><th></th></tr> <tr><th width="80"></th> <th width="21%">Jan</th> <th width="21%">Feb</th> <th width="21%">Mar</th> <th width="21%">Totals</th></tr> The number of cells plus the number of cells spanned in a row must equal the total number of cells (or columns) in the other rows within the table. There are five cells (or columns) in the other rows--thus the row just colspan="3" Figure 5.18 The middle cell in the first heading row is set to span three columns.