Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Very simple CSS question on table row color

Reply
Thread Tools

Very simple CSS question on table row color

 
 
* Tong *
Guest
Posts: n/a
 
      05-29-2005
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: http://xpt.sourceforge.net/
- All free contribution & collection
 
Reply With Quote
 
 
 
 
Steve Pugh
Guest
Posts: n/a
 
      05-29-2005
* Tong * <(E-Mail Removed)> wrote:

>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

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <(E-Mail Removed)> <http://steve.pugh.net/>
 
Reply With Quote
 
 
 
 
David Dorward
Guest
Posts: n/a
 
      05-29-2005
* Tong * wrote:
> 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.

http://css.nu/pointers/index.html#Tutorials

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
 
Reply With Quote
 
* Tong *
Guest
Posts: n/a
 
      05-29-2005
Hi, thank you all who replied, Steve and David.

On Sun, 29 May 2005 17:47:42 -0400, * Tong * wrote:

> 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!

--
Tong (remove underscore(s) to reply)
*niX Power Tools Project: http://xpt.sourceforge.net/
- All free contribution & collection

 
Reply With Quote
 
* Tong *
Guest
Posts: n/a
 
      05-29-2005
On Sun, 29 May 2005 19:35:02 -0400, * Tong * wrote:

>> 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: http://xpt.sourceforge.net/
- All free contribution & collection
 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      05-29-2005
Previously in alt.html, * Tong * <(E-Mail Removed)> said:

> Am I getting the syntax right this time?
>
> th { bgcolor: #FFDB4A }


Yes, the syntax is right, but the property name isn't.

http://www.w3.org/TR/CSS2/colors.htm...ckground-color

--
Mark Parnell
http://www.clarkecomputers.com.au
alt.html FAQ :: http://html-faq.com/
 
Reply With Quote
 
Leif K-Brooks
Guest
Posts: n/a
 
      05-30-2005
* Tong * wrote:
> th { bgcolor: #FFDB4A}


background: #FFDB4A
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help running a very very very simple code olivier.melcher Java 8 05-12-2008 07:51 PM
row bottom border in inner table not matching up with row border in outer table phl HTML 1 06-08-2006 03:43 PM
Very very very basic question Peter C Programming 14 02-14-2005 09:46 AM
Table Row Background Color CSS Style Not Working IN Mozilla 1.7.1 Monty HTML 3 08-19-2004 03:17 PM
very Very VERY dumb Question About The new Set( ) 's Raymond Arthur St. Marie II of III Python 4 07-27-2003 12:09 AM



Advertisments