SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member ArsonistX's Avatar
    Join Date
    Oct 2007
    0 Post(s)
    0 Thread(s)

    background image problem

    This is the final step to successfully validating my website as XHTML 1.0 Transitional.
    Hopefully someone can help me..

    Anyways, can somebody tell me what I'm doing wrong? I put a class on a <td> tag and in my style.css file I put:

    .classname { background-image: url('image url');}

    I reload the page and the image is gone. :|
    Completely not there anymore.

    Examples of what is going on:

    html code:
    <td class='latestnews' colspan='6' rowspan='3'  width='143' height='31' />
    css code:
    .latestnews {background-image: url('images/latestnews.gif');}

    If you can help that would be great!

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    0 Post(s)
    0 Thread(s)
    Relative URIs in an external style sheet are relative to the location of the style sheet. In other words, you are referencing a GIF file in a subdirectory of the directory that contains your CSS file. Are you sure that the file path is correct?

    Depending on the server O/S, pathnames may be case sensitive. Make sure the directory isn't named Images and that the file isn't named LatestNews.gif or suchlike.

    Also, IE5/Mac doesn't support single quotes in the url() notation, IIRC. It might be better to use double quotes, or no quotes at all.

    Another thing: you're using the self-closing NET syntax for your <td/> element. That's only allowed for real XHTML. The space before the slash is a hint that you are using pretend-XHTML, in which case you mustn't use this syntax for any element type that isn't declared as EMPTY in the DTD (like img or br). Use <td></td> instead.

    (See Frequently Asked Questions About XHTML vs HTML if you don't know what I mean by 'real XHTML' and 'pretend-XHTML'.)
    Birnam wood is come to Dunsinane


Posting Permissions

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