SitePoint Sponsor

User Tag List

Results 1 to 14 of 14

Thread: CSS question

  1. #1
    SitePoint Zealot ThaLIkz's Avatar
    Join Date
    Jan 2002
    Location
    Drenthe, The Netherlands
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS question

    Here's a question, i have a page, it's using a main table that has 3 cells and a foot table, i use 2 colors, one for the 2 cells and the foot table, and onther color for the middle cell. How can i with css give those tables a color???

    I've used the class attribute but that only worked for one cell, does anyone knowz waht i should i do??

  2. #2
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use classes on multiple tables and cells, not just one. ID's must be distinct, but classes can be shared across elements.

    ~~Hope This Helps

  3. #3
    .net install meltdown
    Join Date
    May 2001
    Location
    View Ridge
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm a little vague on what the problem is. It would help out if you posted the code. Sounds like you need to use 2 different classes and assign the classes to the different cells for the effect you want:

    Code:
    <html>
    <head>
    
    <style>
    .firstClass {background-color:#ffccff;}
    .secondClass {background-color:#cccccc;}
    </style>
    
    </head>
    
    <body>
    <table>
      <tr>
        <td class="firstColor"></td>
        <td class="secondColor"></td>
        <td class="firstColor"></td>
      </tr>
      <tr>
        <td colspan="3">This is the footer</td>
      </tr>
    </table>
    </html>
    Not sure if thats what your after?

  4. #4
    SitePoint Zealot ThaLIkz's Avatar
    Join Date
    Jan 2002
    Location
    Drenthe, The Netherlands
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah u almost got it right, but i get the idea, i'll try it tomorrow and i've i have any problems i'll post back

  5. #5
    SitePoint Zealot ThaLIkz's Avatar
    Join Date
    Jan 2002
    Location
    Drenthe, The Netherlands
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And onther question about css

    This is my site : http://www.geocities.com/amstelbier2002/index.html

    I use <ul> tag in my upper right corner, since i started using css the words don't become green(as on the left side) but only the lines under the words, how can i fix it using a stylesheet??

  6. #6
    .net install meltdown
    Join Date
    May 2001
    Location
    View Ridge
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try putting the <a> tags inside the <li>:

    So, this:
    <a href="dl/images/after6beers.gif"><li>After 6 Beers</a>

    Looks like this:

    <li><a href="dl/images/after6beers.gif">After 6 Beers</a></li>

  7. #7
    SitePoint Zealot ThaLIkz's Avatar
    Join Date
    Jan 2002
    Location
    Drenthe, The Netherlands
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thnkz m8, the <a> tag worked and the style code also, thnkz again.

  8. #8
    SitePoint Zealot ThaLIkz's Avatar
    Join Date
    Jan 2002
    Location
    Drenthe, The Netherlands
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well it almost worked , check my test page out, www.geocities.com/amstelbiertest , it's really strange the first class works fine for the td tag but the one in the middle doesen't work, it becomes my background color, check the test page and u'll understand it better

  9. #9
    .net install meltdown
    Join Date
    May 2001
    Location
    View Ridge
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hei,

    I looked at the test page, but am unclear what the problem is.

  10. #10
    SitePoint Zealot ThaLIkz's Avatar
    Join Date
    Jan 2002
    Location
    Drenthe, The Netherlands
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The middle has the same background(red) and it 's supposed to be kind a steel color:

    This is the background color:#8D1F18
    This is the background color of the middle <td> tag:#697C9

    I use this style code:

    <style>
    .border {background-color:#366794;}
    .middle {background-color:#697C9;}
    </style>

    Now i get the background color(the red one) in the middle <td> tag instead of the steel color i want.

  11. #11
    .net install meltdown
    Join Date
    May 2001
    Location
    View Ridge
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is the hex color code your declaring:

    .middle {background-color:#697C9;}

    You need six digits and only have five.

    HTH

  12. #12
    SitePoint Zealot ThaLIkz's Avatar
    Join Date
    Jan 2002
    Location
    Drenthe, The Netherlands
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But if i use it like this:

    <td bgcolor="#697C9" valign=top width="519">

    It wokrs fine, check the test site

  13. #13
    .net install meltdown
    Join Date
    May 2001
    Location
    View Ridge
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, that is a bit of browser funkiness. Although the color declaration works when declaring it using bgcolor, its technically not correct. I don't think your gonna have any luck w/ the CSS until you pick a 6-digit hex value.

    Some more info on color codes & CSS:

    http://www.w3.org/TR/REC-CSS1#color-units

  14. #14
    SitePoint Wizard Ian Glass's Avatar
    Join Date
    Oct 2001
    Location
    Beyond yonder
    Posts
    2,384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or 3-digit -- obviously, that's one for red, one green, and one blue, as opposed to two for each. BTW, the hex code you're looking for is #697c90.

    Another thing that may be giving you grief is that you have serious issues with the HTML code! Correct that and your CSS will probably work much smother.

    ~~Hope This Helps


Bookmarks

Posting Permissions

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