less 路径 写法

项目中想要使用less【css中希望能跟使用变量来控制图片路径】

html:

<header></header>

less:

@url: "http://img0.bdstatic.com/img/image/shouye/";

header{
    height: 4em;
    background: url('@{url}jianbihua0626.jpg') no-repeat;  /* 注意:url里面的''是必要的,否则解析为css的时候好像就会出错 */
    background-size: 100%;
}

解析后的css :

header {
    height: 4em;
    background: url('http://img0.bdstatic.com/img/image/shouye/jianbihua0626.jpg') no-repeat;
    background-size: 100%
}

 

posted @ 2015-06-27 14:41  白小虫  阅读(2083)  评论(0编辑  收藏  举报