homepage Welcome to WebmasterWorld Guest from 54.227.11.45
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderator: open

CSS Forum

    
Controlling Table Cell Spacing in CSS
Controlling Table Cell Spacing in CSS
vivek192




msg:1177296
 12:28 pm on Apr 6, 2005 (gmt 0)

Hi,

I am currently doing one project. In that I need to give cell spacing of table in CSS. If I give common property It comes in all the table. But I have to differentiate the table using class ID .I would like to know how to control the cell spacing of table in CSS.Please help me.

Vivek

 

benihana




msg:1177297
 12:29 pm on Apr 6, 2005 (gmt 0)

#mytable td {
margin:12px;
}

vivek192




msg:1177298
 12:44 pm on Apr 6, 2005 (gmt 0)

Hai thanks for ur reply,

Actual Thing I need is I want to control cell spacing in the CSS class itself, I should not give in in the table property <table cellspacing="1"> I want to give in the CSS class itself. Thats my requirement.

benihana




msg:1177299
 12:51 pm on Apr 6, 2005 (gmt 0)

sorry was in a hurry earlier.

in my post, which is reffereing to a css file,:

#mytable td {
margin:12px;
}

#mytable will match the html <table id="mytable">

td will match any <td> inside <table id="mytable">, and give it a margin of 12px, which if i understand correctly, is what you are asking. You can just as easily use a class by referencing as .mytable instead of #mytable. Using 12px will give large gaps, so you wil have to edit that.

Span




msg:1177300
 1:02 pm on Apr 6, 2005 (gmt 0)

The CSS equivalent of cellspacing is border-spacing.

td {
border-spacing:10px;
}

Not supported by IE, or is it?

vivek192




msg:1177301
 1:27 pm on Apr 6, 2005 (gmt 0)

Thanks for ur reply,

But still the requirment is not fulfilled. My requirement is

1. A table , in that only one row and one column.table no 1.

2. OK. Inside that table, I am placing another table with 3 rows and 3 columns, this is table no2.For this table I am giving Cell spacing as 1.eg <table cellspacing=1>.

3. If I give table no 1 bgcolor= red means , the Inner table will be tablised. using the cellspacing the outline of table 2 will be red.

4. this thing I want to make it in CSS , all other attributes I gave in CSS its working only this cellspacing is pending,

I tried the above 2 steps given above, but It didnt come, I want to give that attribute in a class and call it for some particular table only I want to use.

this is my requirement

vivek

benihana




msg:1177302
 1:41 pm on Apr 6, 2005 (gmt 0)

ok. i see what youre getting at, and my answer doesnt cut it. youll have to wait for someone else to chip in.

webapp




msg:1177303
 9:24 pm on Apr 6, 2005 (gmt 0)

[ edit ] fixed. [ /edit ]

I'm not sure you need to nest the table for it to work:

#table1 {
border-collapse: collapse;
}

#table1 td {
border: 2px solid red; /* 'cellspacing' */
}

<table id="table1">
<tr>
<td>AAA</td>
<td>AAA</td>
<td>AAA</td>
</tr>
<tr>
<td>AAA</td>
<td>AAA</td>
<td>AAA</td>
</tr>
<tr>
<td>AAA</td>
<td>AAA</td>
<td>AAA</td>
</tr>
</table>

nwall




msg:1177304
 1:20 am on Apr 7, 2005 (gmt 0)

ok, span, now why in the world didn't you answer that question when i asked it about a week ago? you even posted in the thread but left no answer..

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved