Reference app relative virtual paths in .css file

后端 未结 8 2097
生来不讨喜
生来不讨喜 2020-12-24 02:03

Assume I have an \"images\" folder directory under the root of my application. How can I, from within a .css file, reference an image in this directory using an ASP.NET app

8条回答
  •  余生分开走
    2020-12-24 03:04

    In case you didn't know you could do this...

    If you give a relative path to a resource in a CSS it's relative to the CSS file, not file including the CSS.

    background-image: url(../images/test.gif);
    

    So this might work for you.

提交回复
热议问题