1 / 11

Tables

Tables. lab5. Drawing a table. Tables are the web designer’s best friend and worst enemy. To draw a table we will use: <TABLE> tag <TR> for raw <TD> tags for column. Cont. example. <table>. <TABLE border=1> <TR> <TD>First Row</TD>

sage-cox
Download Presentation

Tables

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tables lab5

  2. Drawing a table • Tables are the web designer’s best friend and worst enemy. • To draw a table we will use: • <TABLE> tag • <TR> for raw • <TD> tags for column.

  3. Cont. example <table> <TABLE border=1> <TR> <TD>First Row</TD> <TD>First Row</TD> <TD>First Row</TD> </TR> <TR> <TD>First Row</TD> <TD>First Row</TD> <TD>First Row</TD> </TR> </TABLE> <tr> </tr> <td> <td> <td> <td> <tr> <td> </tr> <td> <table>

  4. Table attributes • border • Specifying table sizes (width-height) You can specify width for a table both in percents of page width and in pixels. Example : <TABLE WIDTH=50% BORDER=1> <TR> <TD>Cell Row1 Col1</TD> <TD>Cell Row1 Col2</TD> </TR> <TR> <TD>Cell Row2 Col1</TD> <TD>Cell Row2 Col2</TD> </TR>

  5. Cont. • determine table width in pixels. <TABLE WIDTH=250 BORDER=1> <TR> <TD>Cell Row1 Col1</TD> <TD>Cell Row1 Col2</TD> </TR> <TR> <TD>Cell Row2 Col1</TD> <TD>Cell Row2 Col2</TD> </TR> </table>

  6. Cont. • You can specify table height too. In this way you can determine height and width of table. Width and height of table will be divided between cells in rows and columns so if table width is 100 and there are 2 columns then width of each cell will be 50. • if you put a lot of text in a cell of a table it will be expanded to fit the text in it.

  7. Text alignment in table cells • <TD ALIGN=CENTER> or • <TD ALIGN=RIGHT> or • <TD ALIGN=LEFT> // by default

  8. vertical alignment • Use VALIGN option to <TD> tag (TOP, BOTTOM and MIDDLE. MIDDLE is default. Example : <TABLE WIDTH=50% HEIGHT=100 BORDER=3> <TR> <TD ALIGN=LEFT VALIGN=TOP> sami </TD> <TD ALIGN=RIGHT VALIGN=TOP> engineer </TD> </TR> <TR> <TD ALIGN=LEFT VALIGN=BOTTOM> ali </TD> <TD ALIGN=RIGHT VALIGN=BOTTOM> doctor </TD> </TR> </TABLE>

  9. Merge cells • colspan and rowspan attributes in the <td>...</td> tags. • Eg. Column merging <table border=1> <tr> <td colspan="2">b</td> </tr> <td> &nbsp;</td> <td> &nbsp; </td> </table>

  10. Cont. • Row merging <table border=1> <tr> <td rowspan="2">jhgjhghg</td> <td>hgfhbvv</td> </tr> <tr> <td>jjj</td> </tr> </table>

  11. Images in table cells • inserting <IMG> tag between <TD></TD> tags of a certain cell. <BODY> <TABLE BORDER=4> <TR> <TD><IMG SRC="image53.gif"></TD> </TR> </TABLE>

More Related