Very simple CSS question on table row color

Discussion in 'HTML' started by * Tong *, May 29, 2005.

  1. * Tong *

    * Tong * Guest

    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
    * Tong *, May 29, 2005
    #1
    1. Advertising

  2. * Tong *

    Steve Pugh Guest

    * Tong * <> 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 <> <http://steve.pugh.net/>
    Steve Pugh, May 29, 2005
    #2
    1. Advertising

  3. * 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
    David Dorward, May 29, 2005
    #3
  4. * Tong *

    * Tong * Guest

    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
    * Tong *, May 30, 2005
    #4
  5. * Tong *

    * Tong * Guest

    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
    * Tong *, May 30, 2005
    #5
  6. * Tong *

    Mark Parnell Guest

    Mark Parnell, May 30, 2005
    #6
  7. * Tong * wrote:
    > th { bgcolor: #FFDB4A}


    background: #FFDB4A
    Leif K-Brooks, May 30, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Monty
    Replies:
    3
    Views:
    4,792
    Monty
    Aug 19, 2004
  2. Raymond Arthur St. Marie II of III

    very Very VERY dumb Question About The new Set( ) 's

    Raymond Arthur St. Marie II of III, Jul 23, 2003, in forum: Python
    Replies:
    4
    Views:
    453
    Raymond Hettinger
    Jul 27, 2003
  3. Peter

    Very very very basic question

    Peter, Feb 8, 2005, in forum: C Programming
    Replies:
    14
    Views:
    503
    Dave Thompson
    Feb 14, 2005
  4. olivier.melcher

    Help running a very very very simple code

    olivier.melcher, May 12, 2008, in forum: Java
    Replies:
    8
    Views:
    2,249
  5. Kamaljeet Saini
    Replies:
    0
    Views:
    385
    Kamaljeet Saini
    Feb 13, 2009
Loading...

Share This Page