Click to See Complete Forum and Search --> : CSS newbie question


Dracan
March 7th, 2006, 08:29 AM
Hi. I'm new to using style sheets, and am trying to convert my webpage over to using stylesheets. I'm having a problem when defining the properties of a table.

My original html code was ...

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

I've now changed it to ...

table.main_container
{
border: none;
border-spacing: 0;
border-collapse: separate;
padding: 0;
margin: 0;
background-color: #9999CC;
}

<table class="main_container">

If you look at the following two webpages, you'll see the difference.

http://www.dracan.co.uk/index.php
http://www.dracan.co.uk/index2.php

[EDIT] index2.php is the stylesheet version

The difference is obvious if you alt-tab between each webpage.

Any ideas what I'm doing wrong?

Thanks in advance,
Dan.

bigBA
March 7th, 2006, 11:59 AM
AFAIK there is no equivalent for cellpadding and cellspacing in css.

well, cellspacing (i mean cellpadding, of course :) ) maybe, if you set the padding (css) properties of the tds and ths in your stylesheet.

just go on by letting cellpadding and cellspacing in the table tag.

HanneSThEGreaT
March 7th, 2006, 01:19 PM
BigBA is absolutely correct

Have a look at what the W3C(world wide web consortium) has to say about this - there is a nice example on spacing!

http://www.w3.org/TR/REC-CSS2/tables.html#propdef-border-spacing

Have fun!