Board index » html » Very simple CSS question on table row color

Very simple CSS question on table row color

2005-05-30 05:48:00 AM
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!
--
Tong (remove underscore(s) to reply)
*niX Power Tools Project: xpt.sourceforge.net/
- All free contribution & collection
-
 

Re:Very simple CSS question on table row color

* Tong * <sun_tong@users.sourceforge.net>wrote:
Quote
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"
Quote
Another simple question, how can I make my table border to be thin black
lines (in css)?
table {border: thin solid black;}
Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor
Steve Pugh <steve@pugh.net><steve.pugh.net/>
-

Re:Very simple CSS question on table row color

* Tong * wrote:
Quote
th { bgcolor="#FFDB4A" }
You seem to have just about got the hang of selectors, but between "{" and
"}" you need to put CSS property names, followed by a colon, followed by a
value, each such pair being seperated by a semi-colon.
You can't just dump HTML attributes in there.
css.nu/pointers/index.html
--
David Dorward <blog.dorward.me.uk/><dorward.me.uk/>
Home is where the ~/.bashrc is
-

Re:Very simple CSS question on table row color

Hi, thank you all who replied, Steve and David.
On Sun, 29 May 2005 17:47:42 -0400, * Tong * wrote:
Quote
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?
Quote
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!
--
Tong (remove underscore(s) to reply)
*niX Power Tools Project: xpt.sourceforge.net/
- All free contribution & collection
-

Re:Very simple CSS question on table row color

On Sun, 29 May 2005 19:35:02 -0400, * Tong * wrote:
Quote
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?
Ok, I get this one straight now:
table {border: thin solid black; border-collapse: collapse}
--
Tong (remove underscore(s) to reply)
*niX Power Tools Project: xpt.sourceforge.net/
- All free contribution & collection
-

Re:Very simple CSS question on table row color

Previously in alt.html, * Tong * <sun_tong@users.sourceforge.net>said:
Quote
Am I getting the syntax right this time?

th { bgcolor: #FFDB4A }
Yes, the syntax is right, but the property name isn't.
www.w3.org/TR/CSS2/colors.html
--
Mark Parnell
www.clarkecomputers.com.au
alt.html FAQ :: html-faq.com/
-

Re:Very simple CSS question on table row color

* Tong * wrote:
Quote
th { bgcolor: #FFDB4A}
background: #FFDB4A
-