Sai Bharath
Sai Bharath

Reputation: 359

CSS images path in eclipse

The following is the screen shot of the project structure , please guide me how to specify the image path url

enter image description here

body  {
            background-image: url(../WebContent/css/Expenses2.jpg);

         }

On giving the above path the jpg file does not come as the background colour.

Upvotes: 0

Views: 6307

Answers (2)

Tomas K
Tomas K

Reputation: 371

Simply remove the ... from the url, with ... you are switching to an parent folder

body {
  background-image: url(/WebContent/css/Expenses2.jpg); 
}

Or

body {
  background-image: url(css/Expenses2.jpg); 
}

Upvotes: 1

joe_young
joe_young

Reputation: 4125

Given that the css folder is in the same folder as your expenses.jsp file you should just be able to do

css/Expenses2.jpg

So

body  {
    background-image: url(css/Expenses2.jpg);
}

Upvotes: 1

Related Questions