Very simple CSS question on table row color

T

* Tong *

Hi,

I have a very simple question on defining table row colors in css. Here is my test file:

test.htm:

- - - - >8 - - - -
<head>
<title>Test</title>
<link rel='StyleSheet' href='table.css' type='text/css'/>
</head>
<body>
<table>
<tr>
<th>cl</th><th>c2</th>
</tr>
<tr class="row1">
<td class="col1">1</td>
<td class="col2">2</td>
</tr>
<tr class="row0">
<td class="col1">3</td>
<td class="col2">4</td>
</tr>
<tr class="row1">
<td class="col1">5</td>
<td class="col2">6</td>
</tr>
</table>
</body>
- - - - >8 - - - -

And table.css:

- - - - >8 - - - -
th { bgcolor="#FFDB4A" }
..row1 { bgcolor="#EFEFEF" }
..row0 { bgcolor="#FFFFFF" }
tr.row1 { bgcolor="#EFEFEF" }
tr.row0 { bgcolor="#FFFFFF" }
- - - - >8 - - - -

I want my table show up with nice colors, but I just can't get it works.
What I'm missing?

Another simple question, how can I make my table border to be thin black
lines (in css)?

Thanks a lot!
 
S

Steve Pugh

* Tong * said:
th { bgcolor="#FFDB4A" }
.row1 { bgcolor="#EFEFEF" }
.row0 { bgcolor="#FFFFFF" }
tr.row1 { bgcolor="#EFEFEF" }
tr.row0 { bgcolor="#FFFFFF" }

I want my table show up with nice colors, but I just can't get it works.
What I'm missing?

A basic understanding of CSS syntax.

property: value;
NOT
property="value"
Another simple question, how can I make my table border to be thin black
lines (in css)?

table {border: thin solid black;}

Steve
 
T

* Tong *

Hi, thank you all who replied, Steve and David.

th { bgcolor="#FFDB4A" }

Ahh, silly me.

Am I getting the syntax right this time?

- - - - >8 - - - -
th { bgcolor: #FFDB4A }
..row1 { bgcolor: #EFEFEF }
..row0 { bgcolor: #FFFFFF }
tr.row1 { bgcolor: #EFEFEF }
tr.row0 { bgcolor: #FFFFFF }
- - - - >8 - - - -

Why my table is still not colored as it supposed to?
Another simple question, how can I make my table border to be thin black
lines (in css)?

Thanks to Steve's suggestion, I put the following in my css:

- - - - >8 - - - -
table {border: thin solid black;}
td {border: thin solid black;}
- - - - >8 - - - -

But it is not exactly as I hoped -- I get double borders with white space
in between them -- the corner of a cell look something like "#".

How can I make my whole table/cells separated by single thin black lines?

thanks a lot!
 
T

* Tong *

Thanks to Steve's suggestion, I put the following in my css:

- - - - >8 - - - -
table {border: thin solid black;}
td {border: thin solid black;}
- - - - >8 - - - -

But it is not exactly as I hoped -- I get double borders with white space
in between them -- the corner of a cell look something like "#".

How can I make my whole table/cells separated by single thin black lines?

Ok, I get this one straight now:

table {border: thin solid black; border-collapse: collapse}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top