Topic: how to convert table cellspacing attribute? (Page 1 of 1) Pages that link to <a href="" title="Pages that link to Topic: how to convert table cellspacing attribute? (Page 1 of 1)" rel="nofollow" >Topic: how to convert table cellspacing attribute? <span class="small">(Page 1 of 1)</span>\

Nervous Wreck (II) Inmate

From: sj, ca, usa
Insane since: Feb 2002

IP logged posted posted 03-12-2003 00:37 Edit Quote

how do you convert this to pure CSS?

<table cellspacing=0 cellpadding=0 border=0>

i tried making a class for the table and defining a .css as follows:

<table class="myTable">

.myTable {

but i'm still finding a 1-2px space all around that table. if i define everything in css and also add cellspacing=0 in the table tag, the space is all gone. any ideas what's going on here, or is this a bug?

"there has to be a solution."

Maniac (V) Inmate

From: out of a sleepy funk
Insane since: Aug 2000

IP logged posted posted 03-12-2003 01:45 Edit Quote

mebbe try defining a 0px margin for .td as well? Good question as there's no real cellspacing attribute. Logic would dictate what I said with the TD but that'd be my logic and sometimes it's flawed. That means it will most likely work in IE but nothing else


Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

IP logged posted posted 03-12-2003 02:11 Edit Quote

Yes, JK is right.

The <td> attribute needs to have the padding and margins set to zero to replicate the cellpadding/cellspacing=0 bit, since the <td> is what is referred to by the "cell" part of cellspacing.

To get a margin of 0 around the table, you need to make sure the other objects around it don't have a margin that is effecting the table, or padding if the table is *inside* another element.

Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

IP logged posted posted 03-12-2003 04:26 Edit Quote

I've found that setting margins, borders, and padding to TD's doesn't actually solve the problem, unless I *also* add the following rule to the Table's CSS:


Then everything works as expected, with zero space between the cells.

Neurotic (0) Inmate
Newly admitted

Insane since: Apr 2005

IP logged posted posted 04-28-2005 09:11 Edit Quote

Hello everyone,
I am new to this forum.

I am facing the same problem of table cellspacing. I have tried to use the attribute given by "Slime". but still its not working.

My style is as follows:

border-collapse: collapse;

Is this the right way? Plzz help....its urgent

Paranoid (IV) Inmate

From: Florida
Insane since: Mar 2005

IP logged posted posted 04-28-2005 10:09 Edit Quote

The CSS to do it would be...

table { border-spacing: 0; }

...BUT Internet Explorer does not yet support this, so (if you care about Internet Explorer) you may as well just use...

<table cellspacing="0">

(Edited by reisio on 04-28-2005 10:12)

Bipolar (III) Inmate

From: London
Insane since: Jun 2003

IP logged posted posted 04-28-2005 10:37 Edit Quote

I wouldn't say that CSS support for tables is perfect and would be inclined to just use cellspacing="0" border="0" and cellpadding="0", it's no big deal.

Bipolar (III) Inmate

From: 1393
Insane since: Dec 2003

IP logged posted posted 05-02-2005 05:06 Edit Quote

I agree with blaise... I always throw in cellspacing="0" and cellpadding="0" and control everything else with css. I usually use something like table.className as it seems to work better when defining width's and what not.

Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

IP logged posted posted 05-02-2005 05:11 Edit Quote

You may probably need to add the attributes to the td cells as well

td.mytd {
margin: 0px;
padding: 0px;

.:[ Never resist a perfect moment ]:.

Post Reply
Your User Name:
Your Password:
Login Options: Remember Me On This Computer
Your Text:
Options: Show Signature
Enable Slimies
Enable Linkwords

« BackwardsOnwards »

Show Forum Drop Down Menu