aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Adjusting location of images in a CSS file using url() ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Adjusting location of images in a CSS file using url() ?" Watch "Adjusting location of images in a CSS file using url() ?" New topic
Author

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

Rajesh Khan
Ranch Hand

Joined: Oct 16, 2011
Posts: 230
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??
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61661
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adjusting location of images in a CSS file using url() ?