How do I refer to an image resource from CSS in grails?

后端 未结 5 2009
别那么骄傲
别那么骄傲 2021-02-13 20:07

I want to refer to an image in my main stylesheet for a Grails app and I can\'t get it to work. My image lives in the standard location in my Grails app...

proj         


        
5条回答
  •  别那么骄傲
    2021-02-13 20:58

    Typically you would reference a resource in a style sheet as a relative url. The url of your image should be relative to the CSS file's location. So ../images/outbound-blue.png from /appName/css/main.css will be referencing /appName/images/outbound-blue.png

    If you are still having issues, You can debug this by using a tool like firebug to inspect the page and verify each step in your style.
    Verify that:

    • The item that you think is being styled is picking up the styles.
    • The image that you are referencing can be accessed both manually, and via firebug.
    • The css file that you are loading isn't cached and is actually refreshed by the browser.

提交回复
热议问题