CSS & tables backgrounds question?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Collectors-info
    General

    • Feb 2006
    • 8703

    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.
    Regards Chris.

    Collectables, Collecting, collectors-info.com

    www.chrismorris.co.uk

    House build project
  • Watdaflip
    Major General

    • Sep 2005
    • 2116

    #2
    Re: CSS &amp; 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

    Comment

    • Collectors-info
      General

      • Feb 2006
      • 8703

      #3
      Re: CSS &amp; tables backgrounds question?

      Many, many thanks Watdaflip. I have been playing already. That saved me a lot of time.
      Regards Chris.

      Collectables, Collecting, collectors-info.com

      www.chrismorris.co.uk

      House build project

      Comment

      • Watdaflip
        Major General

        • Sep 2005
        • 2116

        #4
        Re: CSS &amp; 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

        Comment

        Working...
        X