Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


<TD> Table Cell Elements

The commands that can go inside <TD> are:

ALIGN - Controls whether the data inside a cell is aligned on the LEFT, RIGHT, or CENTER. Default is LEFT.

Table Row Table Row
Table Row Table Row

tablecode.gif (633 bytes)

			
<table border="1" width="50%">
<tr>
<td>Table Row</td>
<td>Table Row</td>
</tr>
<tr>
<td align="right">Table Row</td>
<td>Table Row</td>
</tr>
</table>

hr1.gif (724 bytes)

VALIGN - Controls whether the data inside a cell is aligned on the TOP, BOTTOM, BASELINE, or CENTER. Default is CENTER.

Table
Row
Table Row
Table
Row
Table Row

tablecode.gif (633 bytes)

		
<table border="1" width="50%">
<tr>
<td>Table<br>Row</td>
<td>Table Row</td>
</tr>
<tr>
<td>Table<br>Row</td>
<td valign="bottom">Table Row</td>
</tr>
</table>

hr1.gif (724 bytes)

WIDTH - Controls the width of the cell, in pixels or percentage.

Table Row Table Row
Table Row Table Row

tablecode.gif (633 bytes)

		
<table border="1" width="70%">
<tr>
<td>Table Row</td>
<td>Table Row</td>
</tr>
<tr>
<td>Table Row</td>
<td width="80%">Table Row</td>
</tr>
</table>

hr1.gif (724 bytes)

HEIGHT - Controls the height of the cell, in pixels or percentage.

Table Row Table Row
Table Row Table Row

tablecode.gif (633 bytes)

		
<table border="1" width="50%"> 
<tr>
<td>Table Row</td>
<td>Table Row</td>
</tr>
<tr>
<td>Table Row</td>
<td height="40">Table Row</td>
</tr>
</table>

hr1.gif (724 bytes)

NOWRAP - Controls the cell so that any data does not wrap to fit the width of the cell.

Table Row Table Row
Table Row Controls the cell so that any data does not wrap to fit the width of the cell.

tablecode.gif (633 bytes)

		
<table border="1" width="50%">
<tr>
<td>Table Row</td>
<td>Table Row</td>
</tr>
<tr>
<td>Table Row</td>
<td nowrap>Controls the cell so that any data does not wrap to fit the width of the cell.</td>
</tr> </table>

hr1.gif (724 bytes)

BGCOLOR - Specifies the background color of the cell in Hex or RGB triplet.

Table Row Table Row
Table Row Table Row

tablecode.gif (633 bytes)

		
<table border="1" width="50%">
<tr>
<td>Table Row</td>
<td>Table Row</td>
</tr>
<tr>
<td>Table Row</td>
<td bgcolor="gray">Table Row</td>
</tr>
</table>

hr1.gif (724 bytes)

Column and Row Spanning - <COLSPAN> <ROWSPAN>

Spanning can be one of the most confusing Table elements (it also was for me personally). The example below will be pretty complex, so look at the Table source closely. The example is using a Border of 1, Cellpadding of 5, and Width of 100%. The Table also has 5 rows and 5 columns.

The commands are:

ROWSPAN - Controls how many rows the cell spans. Default is 1.
COLSPAN - Controls how many columns the cell spans. Default is 1.
Bands I listened to Monday through Friday
Soundgarden Nine Inch Nails House of Pain LL Cool J 311
Rush White Zombie Quad City DJ's R.E.M.
Pearl Jam Cypress Hill Beck Superdrag
Metallica Sponge Fun Lovin' Criminals
Nada Surf Hole KMFDM Gravity Kills Filter

tablecode.gif (633 bytes)

<table border="1" cellpadding="5"
width="100%">
<tr>
<td align="center" colspan="5">
Bands I listened to Monday through Friday</td>
</tr>
<tr>
<td>Soundgarden</td>
<td>Nine Inch Nails</td>
<td>House of Pain</td>
<td rowspan="2">LL Cool J</td>
<td>311</td>
</tr>
<tr>
<td>Rush</td>
<td>White Zombie</td>
<td>Quad City DJ's</td>
<td>R.E.M.</td>
</tr>
<tr>
<td colspan="2">Pearl Jam</td>
<td>Cypress Hill</td>
<td>Beck</td>
<td rowspan="2">Superdrag</td>
</tr>
<tr>
<td>Metallica</td>
<td>Sponge</td>
<td colspan="2">Fun Lovin' Criminals</td>
</tr>
<tr>
<td>Nada Surf</td>
<td>Hole</td>
<td>KMFDM</td>
<td>Gravity Kills</td>
<td>Filter</td>
</tr>
</table>

hr1.gif (724 bytes)

Table Headers <TH></TH> can be substituted anywhere <TD></TD> is. They act exactly the same and can be used as <TD> is, except the Default is bold and centered.

Table Header Table Header
Table Cell Table Cell

tablecode.gif (633 bytes)

		
<table border="1" width="50%">
<tr>
<th width="50%">Table Header</th>
<th width="50%">Table Header</th>
</tr>
<tr>
<td width="50%">Table Cell</td>
<td width="50%">Table Cell</td>
</tr>
</table>

hr1.gif (724 bytes)



Up to => Home / Quadzilla / Tables




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers