我注意到在使用 Less 和字体简写时出现问题
.font(@weight: 300, @size: 22px, @height: 32px) {
font: @weight @size/@height "Helvetica Neue", Arial, "Liberation Sans", FreeSans, sans-serif;
}
以上失败
this.a.toCSS is not a function
http://localhost/tumblr/modern1/css/style.less on line 1, column 0:
1. @highlight: #cb1e16;
2. @shade1: #cb1e16;
当我拆分属性时它起作用了
.font(@weight: 300, @size: 22px, @height: 32px) {
font-weight: @weight;
font-size: @size;
line-height: @height;
font-family: "Yanone Kaffeesatz", "Helvetica Neue", Arial, "Liberation Sans", FreeSans, sans-serif;
我认为这是因为斜杠/那导致了问题,我认为因为 Less 可以进行计算,例如。 2px + 5 = 7px
它试图做一个划分?
最佳答案
刚遇到这个问题,转义函数(无论如何对于 less.js)是: e() 像这样
font: @weight @size e('/') @height "Helvetica Neue", Arial, "Liberation Sans", FreeSans, sans-serif;
关于css - 使用 Less 时在 CSS 值中斜线 (`/` )(例如在 `font` 简写中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40240103/