我的_main.less文件中有以下样式
#mapid {
width: 100%;
min-height: min(65vh, 500px);
max-height: 500px;
}
Run Code Online (Sandbox Code Playgroud)
但是 Less 编译器抱怨(使用 grunt)
>> File "public/less/_main.less" changed.
Running "less:development" (less) task
>> ./public/less/_main.less: [L86:C14] error evaluating function `min`: incompatible types
Warning: Error compiling ./public/less/_main.less Use --force to continue.
Aborted due to warnings.
Run Code Online (Sandbox Code Playgroud)
但这在 CSS 中运行良好(请参阅文档)。
请参阅禁用 LESS-CSS 覆盖 calc(),您可以在 LessCSS 中使用转义字符串:
#mapid {
width: 100%;
min-height: ~"min(65vh, 500px)";
max-height: 500px;
}
Run Code Online (Sandbox Code Playgroud)