HTML Table
Examples
HTML Table Tags
Examples II: Advanced
- CELLPADDING="10"
<TABLE BORDER="7"
CELLPADDING="10">
<TR> <TD>This is a TD cell</TD> <TD><PRE> </PRE></TD> <TH>This is a TH cell</TH> </TR> <TR> <TH VALIGN="TOP">Text aligned top</TH> <TH>Image in TH cell with default alignments ---></TH> <TH><IMG SRC="blylplne.gif" ALT="airplane"></TH> </TR> <TR> <TH VALIGN="BOTTOM">Text aligned bottom</TH> <TD><Image in TD cell with default alignments ---></TD> <TD><IMG SRC="blylplne.gif" ALT="airplane"></TD> </TR> </TABLE> |
|
- CELLSPACING="10"
<TABLE BORDER="7"
CELLSPACING="10">
<TR> <TD>This is a TD cell</TD> <TD><PRE> </PRE></TD> <TH>This is a TH cell</TH> </TR> <TR> <TH VALIGN="TOP">Text aligned top</TH> <TH>Image in TH cell with default alignments ---></TH> <TH><IMG SRC="blylplne.gif" ALT="airplane"></TH> </TR> <TR> <TH VALIGN="BOTTOM">Text aligned bottom</TH> <TD><Image in TD cell with default alignments ---></TD> <TD><IMG SRC="blylplne.gif" ALT="airplane"></TD> </TR> </TABLE> |
|
- TWO COLUMNS:
FIRST CELL WIDTH="50%"
<TABLE BORDER="7">
<TR> <TH WIDTH="50%">This cell will expand to 50% if the contents of the other cell will allow.</TH> <TH>The first cell will expand to 50% if the contents of this cell will allow.</TH> </TR> </TABLE> |
|
- THREE COLUMNS:
FIRST CELL WIDTH="50%"
<TABLE BORDER="7">
<TR> <TH WIDTH="50%">This cell will expand to 50% if the contents of the other cells will allow.</TH> <TH>The first cell will expand to 50% if the contents of the other cells will allow.</TH> <TH>The first cell will expand to 50% if the contents of the other cells will allow.</TH> </TR> </TABLE> |
|
- COLSPAN="2"
<TABLE BORDER="7">
<TR> <TD>This is a TD cell</TD> <TH COLSPAN="2">This TH cell spans two columns</TH> </TR> <TR> <TD><PRE> </PRE></TD> <TD><PRE> </PRE></TD> <TH ALIGN="LEFT">Text aligned left</TH> </TR> <TR> <TD><PRE> </PRE></TD> <TH><IMG SRC="redball.gif" ALT="*"></TH> <TH ALIGN="RIGHT">Text aligned right</TH> </TR> </TABLE> |
|
<TABLE BORDER="7">
<TD><PRE> </PRE></TD> <TH>Below is a null cell.</TH> <TD><PRE> </PRE></TD> </TR> <TR> <TD><PRE> </PRE></TD> <TD></TD> <TD><PRE> </PRE></TD> </TR> <TR> <TD><PRE> </PRE></TD> <TH>Above is a null cell.</TH> <TD><PRE> </PRE></TD> </TR> </TABLE> |
|
- ROWSPAN="3"
<TABLE BORDER="7">
<TR> <TD>This is a TD cell</TD> <TH ROWSPAN="2"><This TH cell spans three rows</TH> <TH>This is a TH cell</TH> </TR> <TR> <TD><PRE> </PRE></TD> <TD><PRE> </PRE></TD> </TR> <TR> <TH ALIGN="LEFT">Text aligned left</TH> <TH ALIGN="RIGHT">Text aligned right</TH> </TR> </TABLE> |
|
<TABLE BORDER="7"
CELLSPACING="10">
<TR> <TH><IMG SRC="redball.gif" ALT="*"></TH> <TD><PRE> </PRE></TD> <TH><IMG SRC="redball.gif" ALT="*"></TH> </TR> <TR> <TD><PRE> </PRE></TD> <TD> <TABLE BORDER="7" CELLSPACING="5"> <CAPTION ALIGN="BOTTOM"> The USS Enterprise arrives home </CAPTION> <TR> <TD><IMG SRC="ee.jpg" ALT="Star Trek pic"></TD> </TR> </TABLE> </TD> <TD><PRE> </PRE></TD> </TR> <TR> <TD ALIGN=:LEFT"><B>Bold Text in a TD cell</B></TD> <TD><BR></TD> <TD><I>Italic Text in a TD cell</I></TD> </TR> </TABLE> |
|
- For
141 color names (including the
16 listed in the HTML 3.2 documentation) go to the Color page.
- IN
TR TAG WITH IMAGE.
Example code
|
Results of example code
|
||||
|
|
Example code
|
Results of example code
|
||||||||||
|
|
Example code
|
Results of example code
|
||||||
|
|
Example Code
|
Code Result
|
|||
<TABLE BORDER="7"
CELLPADDING="10" CELLSPACING="10"
BGCOLOR="#0000FF">
<CAPTION ALIGN="BOTTOM">Butterfly</CAPTION> <TR> <TD> <TABLE BORDER="7" CELLPADDING="10" CELLSPACING="10" BGCOLOR=#FF0000> <TR> <TD><IMG SRC="bfly.gif" ALT="butterfly"></TD> </TR> </TABLE> </TD> </TR> </TABLE> |
|
- IN
TABLE TAGS, CELLSPACING COLORING
- Example A:
with an outer border
Example Code
|
Code Result
|
|||
<TABLE BORDER="0" CELLPADDING="0"
CELLSPACING="0" BGCOLOR="#0000FF">
<TR> <TD> <TABLE BORDER="5" CELLPADDING="10" CELLSPACING="10"> <TR> <TD BGCOLOR="#FFFFFE"> blah blah blah blah</TD><TD BGCOLOR="#FFFFFE"> more blah blah blah blah</TD> </TR> </TABLE> </TD> </TR> </TABLE> |
|
- Example B:
with no outer border
Example Code
|
Code Result
|
|||
<TABLE BORDER="0"
CELLPADDING="0" CELLSPACING="0"
BGCOLOR="#0000FF">
<TR> <TD> <TABLE BORDER="0" CELLPADDING="10" CELLSPACING="10"> <TR> <TD BGCOLOR="#FFFFFE"> blah blah blah blah</TD><TD BGCOLOR="#FFFFFE"> more blah blah blah blah</TD> </TR> </TABLE> </TD> </TR> </TABLE> |
|
Example code
|
Results of example code
|
|||||
|
|
BAR GRAPH EXAMPLE
Example code
|
Results of example code
|
|||||||||||||||||||||||||
|
|
No comments:
Post a Comment