首页 > 其他 > 详细

SASS type-of 函数

时间:2014-10-20 13:27:39      阅读:230      评论:0      收藏:0      [点我收藏+]

今儿写个type-of,算是备忘录吧。

1.number

type-of(0)                    // number
type-of(1px)                  // number

2.string

type-of(a)                    // string
type-of("a")                  // string

3.bool

type-of(true)                 // bool
type-of(0<1)                  // bool

4.color

type-of(rgba(1,2,3,.3))       // color
type-of(rgb(1,2,3))           // color
type-of(#fff)                 // color
type-of(red)                  // color

5.list(sass.list=js.array)

// 需要加括号
type-of((1px,2px,3px))        // list
type-of((1px 2px 3px rgba(0,0,0,.3))) // list

6.map(sass.map=js.json)

type-of((a:1px,b:2px))        // map

7.null

type-of(null)                 // null

注:检测格式,要用字符串

@if type-of(null) == "null" { ... }

 

SASS type-of 函数

原文:http://www.cnblogs.com/ccforeverd/p/4036886.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!