100 likes | 258 Views
Basics of Tables. Tables Give Flexibility. Are arranged in rows and columns In XHTML, you do not directly define the columns of a table Calculated by browser based on maximum number of cells in any given row. Tables/HTML. The language wasn’t intended for laying out pages
E N D
Tables Give Flexibility • Are arranged in rows and columns • In XHTML, you do not directly define the columns of a table • Calculated by browser based on maximum number of cells in any given row
Tables/HTML • The language wasn’t intended for laying out pages • The table feature was adapted • Not the best system (use CSS) • Requires large amounts of code • Creates problems for disabled users, search engines • Difficult to maintain
A Look at Table HTML • <table width="80%" border="1" cellspacing="0" cellpadding="0"> • <tr> • <td></td> • <td></td> • <td>></td> • </tr> • <tr> • <td></td> • <td></td> • <td></td> • </tr> • </table>
Add Data to Table • The source would now look like this: • <table width="80%" border="1" cellspacing="0" cellpadding="0"><tr><td>Yo</td><td>Graphic of NJ or text here</td><td>></td></tr><tr><td></td><td></td><td>Corzine or Christie?</td></tr></table>
Modify Table • <table width="80%" border="1" cellspacing="0" cellpadding="2"><tr><td rowspan ="2">Hi</td><td></td><td>></td></tr><tr> <td></td><td></td></tr></table>
Borders • <table width="80%" border="1" cellspacing="0" cellpadding="2" bordercolor="#0000CC"> • <TR> • <TD rowspan="2"></TD> • <TD></TD> • <TD></TD> • </TR> • <TR> • <TD></TD> • <TD></TD> • </TR> • </TABLE>
Review • <TABLE> opens the table, and </TABLE> closes it • <TR></TR> specifies the beginning and ending of a table row • <TD></TD> specifies the beginning and ending of table or cell data<TD rowspan="#"></TD> combines 2 or more cells into one • bgcolor="######" gives the table a background color • bordercolor="######" gives the table a border color, if border is 1 or higher in size • border="#" the size of the table border • <TD align=""></TD> aligns the contents of the cell, values in between the quotes are either left, right or center