SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Td tags and background images

    In my efforts to comply with W3C standards, i have come to find out that the background="image.ext" isn't a valid element for a <td> tag.

    So, i'm trying CSS.
    here's my code:
    Code:
    .tblbg1    { background: white url("/images/top_bg.jpg") no-repeat }
    .tblbgnav1 { background: white url("/images/bg_img.jpg") no-repeat }
    Now aside from the fact that theres no bg image showing, i also get warnings for each:

    Line : 21 Level : 1 You have no color with your background-color : .tblbg1
    Line : 22 Level : 1 You have no color with your background-color : .tblbgnav1

    So in a nutshell, how would i get a bg image for just a <td>, and what's that warning mean? (other than the warnings, the page validates for CSS)
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  2. #2
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you've got there looks correct to me. The only thing that I do differently is that I never put quotes around the URL... you can try that and see if it helps.

    If that doesn't solve it, make sure that the images do exist at that location.

    Regarding the warnings... they're just there to help you. Warnings do not invalidate the CSS, they just provide hints at making it better, and possible pitfalls if something isn't showing up the way you expected it to.
    ----Adopt-a-Sig----
    Your message here!

  3. #3
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope, that didn't work at all.

    btw, here's my html
    Code:
        <td colspan="2" class="tblbgnav1" height="141">&nbsp;</td>
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  4. #4
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    think you could post a bit more than that?

    How about the entire HTML + CSS (minus any sensitive information) ?
    ----Adopt-a-Sig----
    Your message here!

  5. #5
    SitePoint Member Fenrir's Avatar
    Join Date
    Jul 2002
    Location
    . .. ... ... .. .
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you just need to add something..

    try this:

    Code:
    .tdlbg1 { background: white url("/images/bg_img.jpg"); background-repeat: no-repeat }
    hope that solves the problem

  6. #6
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    www.webinfractions.com/index.php
    theres the whole source right there.

    And that didn't work fenrir.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  7. #7
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, i've got them all working now.
    Thanks for your help all.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  8. #8
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The classic CSS error. You're using a class that's not defined.

    The example you provided was TBLBG1, so I assume that's the one you're having problems with.

    The only place in which I found that class in use was in NEWS.PHP. However, there is no CSS file linked into that page, and the class is not defined in the inline CSS text in the head of the page.
    ----Adopt-a-Sig----
    Your message here!

  9. #9
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The warnings simply mean that you have defined a background colour without defining a foreground colour at the same time. Good coding practise is to always define these in pairs (I have no idea why) hence the warning from the validator. You can fix it by adding "color: inherit;" to the styles in question.


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
  •