Click here to get back home

How to eliminate space between table border and table contents?

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
How to eliminate space between table border and table contents? Michael Mayo 12-06-2005
Posted by Michael Mayo on December 6, 2005, 1:22 am
Please log in for more thread options


I have a simple html page that contains an image in a single table cell,
surrounded by a border: <http://www.softrains.com/lc/test.html>. I would
like to eliminate the space between the table border and the table
contents. I have tried setting margin: 0 in CSS everywhere, as well as
cellmargin/cellpadding in HTML.

What is the best way to eliminate the extra space between a table border
and its contents?

Thanks,
-Mike

Posted by David Ross on December 5, 2005, 6:32 pm
Please log in for more thread options


Michael Mayo wrote:
>
> I have a simple html page that contains an image in a single table cell,
> surrounded by a border: <http://www.softrains.com/lc/test.html>. I would
> like to eliminate the space between the table border and the table
> contents. I have tried setting margin: 0 in CSS everywhere, as well as
> cellmargin/cellpadding in HTML.
>
> What is the best way to eliminate the extra space between a table border
> and its contents?

Don't use a table for this. Use a style-sheet or local style to
set the border on the image itself. Center the image using a div
with a centered style:
        <div style="text-align:center"><img . . .></div>
(But I would probably use <p align="center">, which is still
tolerated under HTML 4.01 transitional.)

Tables should be used only to present information in a tabular
arrangement.

--

David E. Ross
<URL:http://www.rossde.com/>

I use Mozilla as my Web browser because I want a browser that
complies with Web standards. See <URL:http://www.mozilla.org/>.

Posted by none on December 6, 2005, 11:33 am
Please log in for more thread options


On Mon, 05 Dec 2005 18:32:08 -0800, David Ross wrote:
> Don't use a table for this.
> Tables should be used only to present information in a tabular
> arrangement.

You're right, but for political reasons I can't do it this way. I would
probably be beheaded in public.

-Mike

Posted by boclair on December 6, 2005, 1:38 am
Please log in for more thread options


Michael Mayo wrote:
> I have a simple html page that contains an image in a single table cell,
> surrounded by a border: <http://www.softrains.com/lc/test.html>. I would
> like to eliminate the space between the table border and the table
> contents.
> What is the best way to eliminate the extra space between a table border
> and its contents?

Add border-collapse:collapse to table style

Louise

Posted by none on December 6, 2005, 11:28 am
Please log in for more thread options


On Tue, 06 Dec 2005 01:38:14 +0000, boclair wrote:
> Add border-collapse:collapse to table style

Thanks very much for that answer! I read the w3c document on this and
it seems that the newer "collapsing border" model is much more versatile.
However, I also discovered that I could do it in the old model by
specifying a 'border-spacing' property:

border-collapse: separate;
border: solid #41A0D0 2px;
border-spacing: 0px;

Is there a preferred way to do it?

Thanks,
-Mike


Similar ThreadsPosted
Fixing a Table of Contents Menu, when contents Scroll May 5, 2008, 7:40 am
Multiple-level Table of Contents April 6, 2006, 9:59 am
table/cell contents postioning question? September 3, 2005, 10:27 am
Vertical alignment of table cell contents in FireFox August 27, 2006, 5:55 am
Table border (outside only) August 6, 2004, 8:16 am
table cell border and css February 4, 2005, 10:32 pm
Table border & backgroundcolor May 11, 2005, 4:51 pm
Bottom border on after the headings on the table.. November 19, 2004, 2:23 am
Why Blank Space on Last Row of Table? July 29, 2004, 3:00 am
Div in Table Cell extra space July 29, 2004, 2:26 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap