★ wanayoo — archive 1999 http://webdeveloper.com/html/html_table_tricks_2.htmlNouvelle recherche | Portail wanayoo
internet.com

Go to WebDeveloper Home

Seek and you shall

or search all of internet.com
Looking for a Site Map?

Click here to sign up for a FREE Refer-it Webmaster Account

Jobs!
Find a job or the right person

The Web Developer Network
WebDeveloper.com ®
Streaming Media World
WebReference.com
Web Developer's Virtual Library
BrowserWatch
Java Boutique
Web Developer's Journal
JavaScript Source
ScriptSearch
Web Developer Forums
Web Developer News

internet.com
Internet News
Internet Stocks/VC
Internet Technology
Windows Internet Tech.
Linux/Open Source
Web Developer
ECommerce/Marketing
ISP Resources
ASP Resources
Wireless Internet
Downloads
Internet Resources
Internet Lists
International

Search internet.com
Advertising Info
Corporate Info

internet.commerce
Be a Commerce Partner
Computer Help
Survey Your Web Users
PDA Time Tracking
News to Your Desktop
Build Your Intranet
Offer Free Email
IT Products and Svcs
Free Disk Space
Hosting Services
Software Specials

 
WebReference.com HTML (sample)

Text (sample)
Free HTML Newsletters
H T M L
WebDeveloper.com

Table Tricks and Truths
(Part 2)

By Peter Cooper

Gaps and Spaces

Many intermediate and advanced HTML coders will already be aware of cell borders, padding and spacing. However, there are coders who continue to ask questions about these aspects of coding tables, and this is the best place to cover them.

The CELLPADDING, BORDER, and CELLSPACING attributes should all be within the TABLE tag to guarantee compliance between the two main browsers.

The CELLPADDING attribute defines the amount of pixels to pad a cell with. Your cell may be 400 pixels wide, but if the cellpadding is set at 5 pixels, then an internal border of 5 pixels will be present within the table. It's not visible, but it's there so that your content doesn't sit right on the edges of the cell. As such, a 400 pixel wide cell with 5 pixels padding, has an effective usable width of 390 pixels.

The BORDER attribute defines the padding around the entire table. When BORDER is not equal to zero, a visible border will be placed around the outside of the table which is x pixels wide (x being the value, in pixels, assigned to the BORDER attribute). The border gives the entire table a 'raised' feel making it look slightly more 3D. An example is shown below:

This table has a border of 5 pixels.. and this cell has a padding of 10 pixels, as defined by CELLPADDING.

This table has a border of 2 pixels.. and this cell has a padding of 2 pixels, as defined by CELLPADDING.

The CELLSPACING attributes defines the space between all cells. This allows breathing space between the cells, and doesn't squash the content of the cells at all, as with CELLPADDING. Some examples are shown below:

This table has a CELLSPACING of 12 and a CELLPADDING of 0. This table has a CELLSPACING of 12 and a CELLPADDING of 0.

This table has a CELLSPACING of 3 and a CELLPADDING of 0. This table has a CELLSPACING of 3 and a CELLPADDING of 0.

You can use each of these elements individually or all together, but if used they must only be used within the opening of the TABLE tag as so, where x, y, and z are replaced with your own values:

<table border=x cellpadding=y cellspacing=z>

Want any specific table questions answered? If so, e-mail your queries, suggestions and comments to pcooper@internet.com

[ Click here to jump back to the first part of the article ]

This article first appeared in January, 2000.

Fast Jump to Anywhere on WebDeveloper.com®:



Copyright © 1999-2000 internet.com Corp.
All Rights Reserved. Legal Notices.
Contact the WebDeveloper.com® staff

Last modified: Thu Jun 15 06:11:36 EDT 2000

http://www.internet.com

 

Refresh Daily
Join Editor-in-Chief David Fiedler The Editor With No Time and find truth, justice, and a clue or two.


Browse by Category
[ Site Map ]

ActiveX / VBscript
Animated GIF Archive
Browsers
CGI / Perl
Database Connectivity
Design / Graphics
E-Commerce
HTML-Advanced: DHTML, CSS
HTML / Site Authoring Tools
Intranet/Groupware
Java
JavaScript
Multimedia: Audio / Video / Streaming Technologies
Opinions
Refresh Daily: Editorial Column
Security
Servers & Server Tools
Site Design / Graphics
Site Management / Marketing / Log File Analysis
Tutorials
VRML / 3D
XML