在 SCSS 中,可以使用 unit() 函数获取值的单位,使用 unitless() 函数获取值是否有单位,使用 inspect() 函数获取值的完整表示。

以下是示例代码:

$width: 100px;

// 获取单位
$unit: unit($width); // 输出:px

// 获取值是否有单位
$is_unitless: unitless($width); // 输出:false

// 获取值的完整表示
$value: inspect($width); // 输出:100px
scss 获取单位 和值

原文地址: https://www.cveoy.top/t/topic/bql5 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录