Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Adjusting location of images in a CSS file using url() ?

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I downloaded a feature having CSS and some images. However i rearranged them removed the images from the CSS folder and inserted them in a separate folder placed next to the cSS folder called Images. The file hierarchy looks like this


Initially the code in the css file was like

which made it appear like this in firefox console
http://localhost:8080/Project/CSS/menubg.gif [HTTP/1.1 404 Not Found 3ms]

How can i adjust the above CSS coed so it looks like the following
http://localhost:8080/Project/Images/menubg.gif

Suggestion??
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You just need to adjust the URLs in the CSS file to address the images. Because CSS files aren't active (so you can't dynamically use the context path), generally page relative URLs are used. E.g. '../../Images/whatever.gif'.

P.S. I highly recommend using only lowercase for folder names.
 
reply
    Bookmark Topic Watch Topic
  • New Topic