LessCss 导入因 url 和锚点失败
我正在尝试导入 .less 文件并在我的主 less 文件中添加一些背景图像。代码是(客户端):
@import "child";
.image{
background-image:url("image.png");
}
从 URL 调用 Less 文件:
http://localhost/mywebsite#/root.
Less 编译导入到:
http://localhost/mywebsite#/root//localhost/mywebsite#/root//mywebsite/child.less
背景图像 url 到:
http://localhost/mywebsite#/root//localhost/mywebsite#/root//mywebsite/image.png
I'm trying to import .less files and add some background images in my main less file. The code is (client-side) :
@import "child";
.image{
background-image:url("image.png");
}
The Less file is called from the URL:
http://localhost/mywebsite#/root.
Less compiled the import to :
http://localhost/mywebsite#/root//localhost/mywebsite#/root//mywebsite/child.less
The background image url to :
http://localhost/mywebsite#/root//localhost/mywebsite#/root//mywebsite/image.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有实例,就很难确定代码加载的路径。
确保使用正确的路径加载文件:
所有 .less CSS 值都将相对于该 URL 加载。
您还可以尝试使用:
如果所有其他方法都失败,您始终可以使用图像的绝对路径
Without a live example, it will be hard to pinpoint the path your code is loading from.
Make sure your loading the files with the correct path:
All .less CSS values will load relative to that URL.
You can also try using:
If all else fails, you could always use an absolute path to the image