#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Bako, CA
    Posts
    42
    Rep Power
    13

    Talking CSS Class Question


    The CSS file that I am creating is going really well, but I'm stuck on a part that I am not sure what to do. I have tried many, many differnet things and am not able to get it to work.

    What I want to do is make all <td>'s by default the color WHITE unless otherwise specified. I have some <td>'s that I want "#183cad" color code. Here is my current CSS File:

    ***********

    BODY
    {
    FONT-SIZE: small;
    BACKGROUND: url(images/bg.gif) #000000 fixed;
    MARGIN: 0px;
    HEIGHT: 0pt
    }
    A:visited
    {
    FONT-WEIGHT: normal;
    FONT-SIZE: 12px;
    COLOR: #000000;
    FONT-FAMILY: Tahoma, Verdana, Helvetica, sans-serif;
    TEXT-DECORATION: none
    }
    A:link
    {
    FONT-WEIGHT: normal;
    FONT-SIZE: 12px;
    COLOR: #000000;
    FONT-FAMILY: Tahoma, Verdana, Helvetica, sans-serif;
    TEXT-DECORATION: none
    }
    A:active
    {
    FONT-WEIGHT: normal;
    FONT-SIZE: 12px;
    COLOR: #000000;
    FONT-FAMILY: Tahoma, Verdana, Helvetica, sans-serif;
    TEXT-DECORATION: none
    }
    A:hover
    {
    FONT-WEIGHT: normal;
    FONT-SIZE: 12px;
    COLOR: #183cad;
    FONT-FAMILY: Tahoma, Verdana, Helvetica, sans-serif;
    TEXT-DECORATION: underline
    }
    TD
    {
    background-color: white;
    }

    *******************

    How do I code in here to specify "#183cad" for different <td>'s ??

    Any help would be greatly appreciated!!!!!!!!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    try using classes or unique ids.
    i.e.

    <td class="class1"></td>
    and
    <style>
    td { background-color: <your default color here> }
    .class1 { background-color: #183cad }
    </style>

    or for the ids:
    <td id="firsttd"></td>
    <style>
    #firsttd, #secondtd, #thirdtd { background-color: #183cad }
    </style>
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Bako, CA
    Posts
    42
    Rep Power
    13
    I have tried both the CLASS and ID Tags within my HTML code to call the funtion in my .css file. I am using an inline CSS File, does this matter? Or does it have to be done a differnet way? Now my CSS File looks like so....

    *******************

    td
    {
    background-color: white }
    .blue { background-color: #183cad }

    *********************

    That's just the last piece. Is that right? If so, it doesn't work. Thanks in advance!!
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    if you use <td class="blue">...</td> it should work since the last definition should override the first.

    it should not matter (in some rare cases it does though) if you use inline css or a linked (<link rel="stylesheet"...>) css.

    there is some other misunderstanding. there is no functions in css...

    if you experience problems on a specific browser only, try not setting up a default color but adding class or id properties to ALL <td> tags.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Bako, CA
    Posts
    42
    Rep Power
    13
    I can't believe I'm having this hard of a time getting this to work hahaah. Anyways, I took into consideration your suggestion on not setting a default color for <TD>'s. So I used the following code in my .css file:

    ********************

    TD
    {
    .white { background-color: white }
    .blue { background-color: #183cad }
    }

    *******************

    Should this code work?
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    try yourself. i am busy answering other peoples questions right now
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    aaaaah sorry, i think you got the syntax messed up.

    it should be:

    TD.white { background-color: white }
    TD.blue { background-color: #183cad }
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Bako, CA
    Posts
    42
    Rep Power
    13
    Well I did try it ;-) And it didn't work for some reason. I'll just keep playing with it. Thanks alot for your support!!!
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Location
    Bako, CA
    Posts
    42
    Rep Power
    13
    AHH HAY! You are the man :-)

    Thank you much

IMN logo majestic logo threadwatch logo seochat tools logo