• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Background Image Problem in External CSS

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am coding a menu that utilizes javascript to change classnames on mouseover and mouseout events on the TD tag. Both Style classes that I use have an image defined for background. If I put the Style classes directly in my page between the Style tags the images appear correctly. If I put the style classes in an external CSS file and use the LINK tag to include it in my page, the images do not appear at all, although the other style properties work. Has anyone experienced this beahavior before and is there anything I can do to fix it??
Thanks,
Mike
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tyr using the full path name to the image and also a relative path to the image and see if either one works...

Eric
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds like an issue with the URLs you're using. The question is, if you're using relative URLs in the CSS file, what are they relative to? Is it the location of the CSS file, or is it the location of the page that the link is on?

I believe it's the former, but my CSS has always worked in both places without error (I think!) and I've never really given it much thought. I use the following directory structure:

My background CSS looks like: { background: url(../images/image-1.gif); }

If your set-up is different to that then this might help you out.

Jules
 
Mike Guthrie
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.
I solved the problem by placing a '../' before the image path. For example, I went from 'images/button.gif' to '../images/button.gif' and that worked.
- Mike
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic