|
||||||||||||
Web Services Home |
|
TablesTables are used to make data easier to interpret or to just give your document more impact. Tables are one of the most challenging things to code with HTML. It isn't very hard, it just takes a while to get the hang of. Tables start with the <table> tag, and MUST end with a </table> tag, or the table will not appear at all.
Table BordersTables usually contain the border=n attribute within the opening tag. If the border=0, then the table's border is invisible. Usually when you do not use the border attribute the table border will become invisible. This is useful when you want to align text in rows and columns, but don't want a table border around it. If border=1 there is a thin border. border=2 is a little thicker, border=3 a little more thick...and so on.
Table Rows and CellsFrom the previous example you may have noticed the <tr> and <td> tags. The <tr> tags define the rows within the table while the <td> tags are the table cells within each row. Most table rows contain more than one cell.Many times, you will need a heading for a column of cells of the first row. To do this, you will use the <th> opening and </th> closing tag. The table heading tag makes the text in that cell BOLD and CENTERED. You only need use the heading cells when necessary.
Rowspan and ColspanThe <td> tag has attributes to change the look of the table. For example, in the previous table you may want Cell One and Four to be combined or Cell Two and Cell Three to be combined. In order to do this, you can use the rowspan=n or colspan=n attributes. The rowspan=n allows you to span rows and colspan=n allows you to span columns.
Other AttributesYou may wish to use the ALIGN and VALIGN attributes to align the contents of cells. If you wish to change the horizontal alignment of the contents of a certain cell, add align=left, align=center, or align=right to the opening <td> tag. If you wish to change the vertical alignment of the contents of a cell, use the valign=top, valign=middle, or valign=bottom attributes. You may also want to try out the WIDTH="n%" attribute, to change the width of a table or a cell.
**Putting together everything we have learned so far, you could produce an HTML document that looks like this: <html>
<head>
<body vlink="red" link="#330066"> </html> To view this web page, click here.
|
||||||||||||||||||||||||||||||||||||||||