Results 1 to 4 of 4

Thread: CSS & tables backgrounds question?
      
   

  1. #1
    Join Date
    Feb 2006
    Location
    Earth
    Posts
    8,721

    Default CSS & tables backgrounds question?

    Hi, I am trying to get a tables with different background colors on the same page.
    I have got to the stage where I can place “lets say” 4 tables on 1 pages & via the remote css sheet I can change the background colour via the <tb> tag.
    But how do I make each table a different colour?


    -----------------------------------------------------------------------------
    td
    {
    background-color: green
    }

    -------------------------------------------------------------------------------
    <table border="0" bordercolor="" width="100" >
    <tr>
    <s1><td> row 1, column 1 </s1></td>
    </tr>
    </table>

    ------------------------------------------------------------------------------
    But not sure what I am doing wrong here.
    -------------------------------------------------------------------------------

    b1
    {
    background-color: red
    }


    <table border="0" bordercolor="" width="100" >
    <tr>
    <b1><td> row 1, column 1 </b1></td>
    </tr>
    </table>
    ----------------------------------------------------------------------------------------------------------



    Thanks.

  2. #2
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default Re: CSS & tables backgrounds question?

    Your going to want to define a css class for each table

    Your css sheet will be something like

    .table1
    {
    background-color: #00FF00;
    }

    .table2
    {
    background-color:#0000CC;
    }

    .table3
    {
    background-color:#FFFF00;
    }

    And then your tables html will be this

    <table class="table1" width="100">
    <tr><td>This has a backgrond</td></tr>
    </table>


    <table class="table2" width="100">
    <tr><td>This has a different background</td></tr>
    </table>


    <table class="table3" width="100">
    <tr><td>As does this</td></tr>
    </table>


    Further, you will probably want to go ahead and define the tables width in the css file as well, instead of the tables html code itself. ( width: 100px )

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

  3. #3
    Join Date
    Feb 2006
    Location
    Earth
    Posts
    8,721

    Default Re: CSS & tables backgrounds question?

    Many, many thanks Watdaflip. I have been playing already. That saved me a lot of time.
    http://www.collectors-info.com/testing/css/cssbg.php

  4. #4
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default Re: CSS & tables backgrounds question?

    Your welcome, any time.

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49