Css file with image inside

Asked

Viewed 54 times

0

Person I’m trying to set inside css an image, for this I’m using:

body {
    margin: 0px;
    padding: 0px;
    background: #C0C4C5 url(images/page-body-bg.png) repeat;
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 13px;
    color: #2E2E2E;
}

I can easily access through the Clink:

http://localhost:8080/Spring4MVCHelloWorldDemo/images/page-body-bg.png

Problem: not loading image, already tried:

background: #C0C4C5 url(images/page-body-bg.png) repeat;
background: #C0C4C5 url(/images/page-body-bg.png) repeat;
background: #C0C4C5 url(./images/page-body-bg.png) repeat;
background: #C0C4C5 url(../images/page-body-bg.png) repeat;

my briefcase is like this: inserir a descrição da imagem aqui

and the mapping in spring.servlet.xml is like this:

<mvc:annotation-driven />
<mvc:resources mapping="/images/**" location="/WEB-INF/images/" />
<mvc:resources mapping="/css/**" location="/WEB-INF/css/" />
  • Like this here url(../images/page-body-bg.png) repeat; should work. Did you clear the browser cache between attempts? Maybe the browser used the first "version" of the css file in all its attempts, ie ignored all edits.

  • i am using the own browser that is opened in eclipse, tb has cache in this browser?

  • 1

    Eclipse doesn’t have a browser of its own, it just uses the default browser on your OS, you just clear its cache. You can also go straight into the browser itself, access the page and force the upload, I believe that in most browsers the shortcut is Ctrl + F5. Another option is to use the browser with the cache disabled in the Developer Tools.

  • Apparently your css should work, but try to put the image in the same css path, and then change the image path and adjust its css. must be some other detail other than the code.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.