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

后端 未结 5 2022
别那么骄傲
别那么骄傲 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:45

    A more portable way to specify image locations is to use the resource() function:

    .messageimg {
        height:17px;
        width:16px;
        background-image:url('${resource(dir: "images", file: "outbound-blue.png")}');
        background-repeat:no-repeat;
    }
    

提交回复
热议问题