Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > replace "cellspacing" with CSS?

replace "cellspacing" with CSS?
Thread Tools
Mac Elite
Join Date: Dec 2002
Location: Silicon Valley
Status: Offline
Reply With Quote
Apr 22, 2003, 07:38 AM
 
is there any CSS tag I can use to replace the table html tag "cellspacing="0""??????????
Anyone who would letterspace blackletter would steal sheep. - Frederic Goudy
     
Dedicated MacNNer
Join Date: Feb 2001
Location: Manhattan
Status: Offline
Reply With Quote
Apr 22, 2003, 12:28 PM
 
...are you still intending on placing your data into a table for layout purposes? just use a div instead...you can then adjust padding or margin to suit your needs, probably margin if you want to mimic cellspacing.

if you still intend on using a table, i think you would have to apply margin to a TD and not the whole table...

anyways, it seems silly to find a css replacement for cellspacing if you're going to continue to use a table (if it for layout purposes)...just use the html attribute; you know it'll work in everything since the birth of netscape...
     
Mac Elite
Join Date: Dec 2002
Location: Silicon Valley
Status: Offline
Reply With Quote
Apr 22, 2003, 02:16 PM
 
Can you put borders on(like a line on the left side) with a DIV?
Anyone who would letterspace blackletter would steal sheep. - Frederic Goudy
     
Dedicated MacNNer
Join Date: Feb 2001
Location: Manhattan
Status: Offline
Reply With Quote
Apr 22, 2003, 02:46 PM
 
Originally posted by Webscreamer:
Can you put borders on(like a line on the left side) with a DIV?
...but of course (though it depends on how much you like your netscape < 5 users):
&lt;style&gt;
#boxWithLeftBorder {
&nbsp;&nbsp;&nbsp;border-left:1px solid black;
}
&lt;/style&gt;

&lt;div id="boxWithLeftBorder"&gt;This would be an example of a box with a left border...much prettier looking code than a multi column table...&lt;/div&gt;
...the ideal would be to separate your content from your style completely, so that you basically have chunks of content and their placement and style is determined by the stylesheet. it's a tough switch from tables to css...i'm currently experimenting to switch one of the sites i manage, nyu.edu, to a non-table layout. there are a bit more politics involved in that switch being that we still have a large population of netscape 4 users and the old table based layout still works perfectly for them. the downside is that in the next two years when we plan a redesign, it'll be a huge pain in our (my) butts to convert the multiple thousand or so pages with the nyu look. with css, you just redefine your info in one spot and instantly your site has been upgraded.

anyways, it's good to learn and use where you know you and your users will benefit from the switch equally.

some good resources for css matters can be found at:
-- jeffrey zeldman, and his site
-- a list apart.

anyways, good luck.
     
Mac Elite
Join Date: Dec 2002
Location: Silicon Valley
Status: Offline
Reply With Quote
Apr 22, 2003, 02:53 PM
 
Hey, my girlfriend wants to go to NYU ;p

can I split a div into colums? I know it defeats the purpose probably ;0

there any good tuorials on this? I have been using tables and when I start converting, I run into probs and I think I needs tables.
Anyone who would letterspace blackletter would steal sheep. - Frederic Goudy
     
Dedicated MacNNer
Join Date: Feb 2001
Location: Manhattan
Status: Offline
Reply With Quote
Apr 22, 2003, 03:02 PM
 
Originally posted by Webscreamer:
Hey, my girlfriend wants to go to NYU ;p
...she should beware, they just increased tuition 6.5%...~$40K a year. but depending on what she wants to study, new york is an awesome place...just not for webdesigners/programmers looking for a job.


can I split a div into colums? I know it defeats the purpose probably ;0

there any good tuorials on this? I have been using tables and when I start converting, I run into probs and I think I needs tables.
sure, you can do something like this (though using tables might be quicker if you have a deadline):

&lt;style&gt;
#container {
&nbsp;&nbsp;&nbsp;/* style declarations here */
}

#left {
&nbsp;&nbsp;&nbsp;float: left;
&nbsp;&nbsp;&nbsp;/* style declaration here */
}

#right {
&nbsp;&nbsp;&nbsp;/* style declaration here */
}
&lt;/style&gt;

&lt;div id="container"&gt;
&nbsp;&nbsp;&nbsp;&lt;div id="left"&gt;Left column content...&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&lt;div id="right"&gt;Right column content...&lt;/div&gt;
&lt;/div&gt;
i haven't tried this, but it should work...

check out A List Apart in their previous issues. you can sort different articles and tutorials by subject. there are a few on moving to a non-table layout.

before long, you'll become obsessed with making your pages in this style...
     
Mac Elite
Join Date: Dec 2002
Location: Silicon Valley
Status: Offline
Reply With Quote
Apr 22, 2003, 08:30 PM
 
what is this " #" stuff in the CSS with divs?? can't you just put .whatever?

and in a div, u have to us ID, or can u just use class?
Anyone who would letterspace blackletter would steal sheep. - Frederic Goudy
     
Dedicated MacNNer
Join Date: Feb 2001
Location: Manhattan
Status: Offline
Reply With Quote
Apr 22, 2003, 09:03 PM
 
Originally posted by Webscreamer:
what is this " #" stuff in the CSS with divs?? can't you just put .whatever?

and in a div, u have to us ID, or can u just use class?
you can use classes too...id is usually for something that you only have one of and classes should be used when you apply the same style multiple times to various pieces...
     
Mac Enthusiast
Join Date: Dec 2002
Location: Amsterdam, Netherlands
Status: Offline
Reply With Quote
Apr 24, 2003, 10:55 AM
 
slightly offtopic: if I understand correctly, it is possible to change every type of table to a &lt;div&gt;-structure?

If so, can you provide an example and for instance change the following table to the &lt;div&gt;-equivalent?

Code:
&lt;table border="1" cellspacing="2" cellpadding="2"&gt; &lt;tr height="20%"&gt; &lt;td colspan="2" width="100%"&gt;r1c1&lt;/td&gt; &lt;/tr&gt; &lt;tr height="80%"&gt; &lt;td width="40%"&gt;r2c1&lt;/td&gt; &lt;td width="60%"&gt;r2c2&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;
rendered to:

<table border="1" cellspacing="2" cellpadding="2">
<tr height="20%">
<td colspan="2" width="100%">r1c1</td>
</tr>
<tr height="80%">
<td width="40%">r2c1</td>
<td width="60%">r2c2</td>
</tr>
</table>
I'm Appleless and unhappy: tiBook is dead and iPod stolen
     
Dedicated MacNNer
Join Date: Feb 2001
Location: Manhattan
Status: Offline
Reply With Quote
Apr 24, 2003, 11:32 AM
 
     
Occasionally Quoted
Join Date: Apr 2001
Location: San Francisco
Status: Offline
Reply With Quote
Apr 24, 2003, 05:34 PM
 
.
(Last edited by daimoni; Jul 10, 2004 at 09:30 AM. )
.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:26 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2