Topic: how to convert table cellspacing attribute? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=10937" 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>\

 
hecster2k
Nervous Wreck (II) Inmate

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

posted posted 03-12-2003 00:37

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 {
margin:0px
border:0px
padding:0px
}

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."

JKMabry
Maniac (V) Inmate

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

posted posted 03-12-2003 01:45

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

Jason

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 03-12-2003 02:11

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.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 03-12-2003 04:26

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:

border-collapse:collapse;

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

html28
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Apr 2005

posted posted 04-28-2005 09:11

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:

#table
{
width:100%;
border:0px;
padding:0px;
margin:0px;
border-collapse: collapse;
}

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

reisio
Paranoid (IV) Inmate

From: Florida
Insane since: Mar 2005

posted posted 04-28-2005 10:09

The CSS to do it would be...

code:
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...

code:
<table cellspacing="0">



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

Blaise
Bipolar (III) Inmate

From: London
Insane since: Jun 2003

posted posted 04-28-2005 10:37

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.

redroy
Bipolar (III) Inmate

From: 1393
Insane since: Dec 2003

posted posted 05-02-2005 05:06

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.

bitdamaged
Maniac (V) Mad Scientist

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

posted posted 05-02-2005 05:11

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:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu