Is there a way to set a common image path for LESS files?

前端 未结 6 1353
面向向阳花
面向向阳花 2020-12-05 03:58

I am using the LESS styling language.

Consider the following CSS:

.side-bg
{
    background:url(../img/layout/side-bg.jpg) top no-repeat;    
}
         


        
6条回答
  •  一整个雨季
    2020-12-05 04:46

    Try using string interpolation for things like this. Look for “variable interpolation” in docs.

    @base-url: "http://assets.fnord.com";
    background-image: url("@{base-url}/images/bg.png");
    

提交回复
热议问题