本文介绍了将CSS变量与scss变暗并使用ligthen过滤器一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在CSS4 lighten()和 darken()
函数> var 。
像这样:
box-shadow:嵌入0px -2px 50px 45px变暗(var(-colorbtn),20%);
似乎不起作用,gulp写道:
错误:$ color: var(-colorbtn)不是'darken'
这不可能吗?
解决方案
因为SASS是预处理器,并且CSS自定义属性可以在运行时动态更改。为了使SASS能够通过变暗进行预处理,必须将自定义属性替换为静态值,在这种情况下,该自定义属性的有用性将丢失。
I would like to use scss lighten()
and darken()
function with CSS4 var
.
Like this :
box-shadow: inset 0px -2px 50px 45px darken(var(--colorbtn),20%);
It seems not working, gulp write this:
Error: $color: "var(--colorbtn)" is not a color for `darken'
Its not possible to do that?
解决方案
This can't really work because SASS is a preprocessor, and CSS custom properties can be dynamically changed at run-time. For SASS to be able to preprocess this with darken, it would have to replace the custom property with a static value, in which case the usefulness of the custom property is lost.
这篇关于将CSS变量与scss变暗并使用ligthen过滤器一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!