Forum Moderators: not2easy

Message Too Old, No Replies

Table Borders - CSS1

How to set some table borders using CSS1

         

stuart

9:13 am on Apr 11, 2005 (gmt 0)

10+ Year Member



Hi, A 1px table border in HTML appears too thick - so i'm trying css but it doesn't seem to work - please can anyone let me know where i'm going wrong? :

table.new { border: thin #285229 }
or
table.new { border: 1px #285229 }

<table class="new" etc etc..>

TIA
stuart

benihana

9:17 am on Apr 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



youve missed the line type of the border, which is essential:

border:1px solid #000;

stuart

9:50 am on Apr 11, 2005 (gmt 0)

10+ Year Member



Thats great, thanks benihana - i see the table cells don't outline like the HTML border does, pls can i ask is a 1px gif ok for that or is there a better way?

benihana

10:40 am on Apr 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if you want to do the cells as well, you need to specify them in the selector:

table.new td {

styles...
}

stuart

11:31 am on Apr 11, 2005 (gmt 0)

10+ Year Member



thx b but still stuck, sorry - this is the style:

table.new td { border: 1px solid #336633 }

table is 2 rows & 1 column - need a 1px border around the table & cell; but now get 2px between the 1st & 2nd row - do i need 2 styles with different widths for the four borders? Or is there a simpler way?

TIA

Robin_reala

11:52 am on Apr 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



table { border-collapse: collapse; }
? Oh hang on, that just get's rid of borders doesn't it?

stuart

12:33 pm on Apr 11, 2005 (gmt 0)

10+ Year Member



this is as close as i've got but its still not right; any ideas would be appreciated :

table.new { border: 1px solid #336633 }

table.new td { border-style: solid; border-width: 1px 0px 0px 0px; border-color: #336633; }

TIA
stuart

stuart

1:33 pm on Apr 11, 2005 (gmt 0)

10+ Year Member



This seems to have cracked it but is it ok to use the 2 styles with the same name 'table.new' and 'table.new td' in the same style sheet?

table.new { border-style: solid; border-width: 0px 1px 1px 1px; border-color: #336633; }

table.new td { border-style: solid; border-width: 1px 0px 0px 0px; border-color: #336633; }

Old_Honky

2:14 pm on Apr 11, 2005 (gmt 0)

10+ Year Member Top Contributors Of The Month



Try writing it like this to utilise the Cascade;


table.new td {border: 1px solid #363;}

table.new {border-width: 0 1px 1px;}

table.new td {border-width: 1px 0 0;}

esllou

2:27 pm on Apr 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the BAD non-css way of doing this is:

<table border="1px" bordercolor="navy">

in the html, worked for me when I last tried it a year ago but it may be a quirks thing, not standards.

katana_one

4:16 pm on Apr 11, 2005 (gmt 0)

10+ Year Member



This seems to have cracked it but is it ok to use the 2 styles with the same name 'table.new' and 'table.new td' in the same style sheet?

Perfectly acceptable.