tables lab5. drawing a table tables are the web designer’s best friend and worst enemy. to draw a...

11
Tables lab5

Upload: neal-simpson

Post on 05-Jan-2016

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Tables lab5. Drawing a table Tables are the web designer’s best friend and worst enemy. To draw a table we will use:  tag  for raw  tags for column

Tables

lab5

Page 2: Tables lab5. Drawing a table Tables are the web designer’s best friend and worst enemy. To draw a table we will use:  tag  for raw  tags for column

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.

Page 3: Tables lab5. Drawing a table Tables are the web designer’s best friend and worst enemy. To draw a table we will use:  tag  for raw  tags for column

Cont. example <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>

>table<

>table<

>tr <

>tr<

>td< />tr<>td< >td<

>td<>td< >td< />tr<

Page 4: Tables lab5. Drawing a table Tables are the web designer’s best friend and worst enemy. To draw a table we will use:  tag  for raw  tags for column

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>

Page 5: Tables lab5. Drawing a table Tables are the web designer’s best friend and worst enemy. To draw a table we will use:  tag  for raw  tags for column

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>

Page 6: Tables lab5. Drawing a table Tables are the web designer’s best friend and worst enemy. To draw a table we will use:  tag  for raw  tags for column

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.

Page 7: Tables lab5. Drawing a table Tables are the web designer’s best friend and worst enemy. To draw a table we will use:  tag  for raw  tags for column

Text alignment in table cells

<TD ALIGN=CENTER> or <TD ALIGN=RIGHT> or <TD ALIGN=LEFT> // by default

Page 8: Tables lab5. Drawing a table Tables are the web designer’s best friend and worst enemy. To draw a table we will use:  tag  for raw  tags for column

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>

Page 9: Tables lab5. Drawing a table Tables are the web designer’s best friend and worst enemy. To draw a table we will use:  tag  for raw  tags for column

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>

b

Page 10: Tables lab5. Drawing a table Tables are the web designer’s best friend and worst enemy. To draw a table we will use:  tag  for raw  tags for column

Cont.

Row merging

<table border=1>

<tr>

<td rowspan="2">jhgjhghg</td>

<td>hgfhbvv</td>

</tr>

<tr>

<td>jjj</td>

</tr>

</table>

Page 11: Tables lab5. Drawing a table Tables are the web designer’s best friend and worst enemy. To draw a table we will use:  tag  for raw  tags for column

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>