330 likes | 1.07k Views
HTML Tables. <table> … </table> surround table <tr> … </tr> surround each row <td> … </td> surround each cell <th> … </th> like <td> , but bold and centered by default (for table headings) <caption> … </caption> table title.
E N D
HTML Tables • <table> … </table> surround table • <tr> … </tr> surround each row • <td> … </td> surround each cell • <th> … </th> like <td>, but bold and centered by default (for table headings) • <caption> … </caption> table title No tag to define a column. Number of columns determined by number of <td></td> pairs in a given row.
Tables and CSS • Use CSS to format tables • background-color, color, font-family, padding, margin, border, text-align … all work with tables and cells • border-collapse: collapse; with without
Spanning Rows and Columns • Can create “irregular” tables • colspan attribute of td: # columns a cell spans <tr> <td colspan=2>A</td> </tr> <tr> <td>B</td> <td>C</td> </tr>
Spanning Rows and Columns • rowspan attribute of td: # rows a cell spans <tr> <td>A</td> <td rowspan=2>B</td> </tr> <tr> <td>C</td> </tr> 29
Planning the Table Anniversary Gift 1st Paper 8th Pottery 9th Happy…
Using tables for layout -------- message --------
Exercise 2 pixel red border 5 pixels btwn text & border