Scss 判断一个值是属于什么类型

css yekong 1424℃

type-of()

函数主要用来判断一个值是属于什么类型
返回值:

number 为数值型。
string 为字符串型。
bool 为布尔型。
color 为颜色型。

>> type-of(100)
"number"
>> type-of(100px)
"number"
>> type-of("asdf")
"string"
>> type-of(asdf)
"string"
>> type-of(true)
"bool"
>> type-of(false)
"bool"
>> type-of(#fff)
"color"
>> type-of(blue)
"color"
>> type-of(1 / 2 = 1)
"string"
喜欢 (0)