Forum Moderators: not2easy

Message Too Old, No Replies

border color for table in css - only around four sides!

         

KatieWestbrook

11:16 am on Mar 10, 2005 (gmt 0)

10+ Year Member



Please help, I am trying to get the equivilent of bordercolor in html in my css file.

Using this code in the css file:

.ts1general {
font-family : Verdana, Arial, Helvetica, Geneva, sans-serif; font-weight: normal; color: #000000; vertical-align: top; border-color: #339999;
}
td.ts1general {
border: #339999;
}

But the teal (#339999) colour is only around the edge of the table, not around each cell as well, which is gray!

Thanks.

sifredi

11:24 am on Mar 10, 2005 (gmt 0)

10+ Year Member



You have to define that there is a border and what attributes it should have:

td.ts1general {
border: 1px solid #399;
}

I assume that all td's have the class "ts1general"? If thats the table's class name, you should do:

.ts1general td { border: 1px solid #399; }

[edited by: sifredi at 11:25 am (utc) on Mar. 10, 2005]

BlobFisk

11:25 am on Mar 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi KatieWestbrook,

It looks like you have got your rules slightly wrong.

You have:


td.ts1general {
border: #339999;
}

Which will tell the browser to put a border (almost, there's no style or width there!) of that colour around all td elements with the class ts1general.

I think that you want to tell the browser to put the border on all td elements within a table of class ts1general:


table.ts1general td {
border: 1px solid #339999;
}

Which says, all td elements within a table of class ts1general should have this border style.

HTH

KatieWestbrook

11:30 am on Mar 10, 2005 (gmt 0)

10+ Year Member



Now there is only a gray border.

Here is my code:

<table class="tslgeneral" cellspacing="0" cellpadding="2" summary="Executive Assistant"><tr><td>test</td><td>test</td></tr></table>

And in the css:

.ts1general .tslgeneral td{
font-family : Verdana, Arial, Helvetica, Geneva, sans-serif; font-weight: normal; color: #000000; vertical-align: top;
}
td.ts1general {
border: 1px solid #339999;
}

?!

KatieWestbrook

11:33 am on Mar 10, 2005 (gmt 0)

10+ Year Member



Sorry blobfisk, I didn't see your reply before, now I have this in css:

.ts1general .tslgeneral td{
font-family : Verdana, Arial, Helvetica, Geneva, sans-serif; font-weight: normal; color: #000000; vertical-align: top;
}
table.ts1general td {
border: 1px solid #339999;
}

Is this correct?

Thanks.

sifredi

12:08 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



May I ask what you are trying to achieve?

KatieWestbrook

12:12 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



A table with a border of 1px in colour #339999, not just around the edge of the table but, like the html attribute 'bordercolor' and 'border' would give, around the cells in-between as well.

sifredi

12:27 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



<table class="tslgeneral" cellspacing="0" cellpadding="2" summary="Executive Assistant"><tr><td>test</td><td>test</td></tr></table>

table.ts1general,
table.ts1general td {
border: 1px solid #399;
}

By separating with a "," you can define several elements with the same style. This code will add a border to the table classed "ts1general" and all cells within that table (watch the cascading space between ts1general and td).

KatieWestbrook

12:55 pm on Mar 10, 2005 (gmt 0)

10+ Year Member



That's worked, thank you!