sass学习8——内置函数2

2018-10-08  本文已影响39人  哈哈乐乐WXT
列表函数:

length() 函数:

.test1 {
    content1: length(1px);
    content2: length(1px 2px);
    content3: length(10px 20px (border 1px solid) 2em);
}

生成为:

.test1 {
  content1: 1;
  content2: 2;
  content3: 4; }

nth() 函数:

.test2 {
    content1: nth(10px 20px 30px, 1);
    content2: nth((Helvetica, Arial, sans-serif), 2);
    content3: nth((1px solid red) border-top green, 1);
}

生成为:

.test2 {
  content1: 10px;
  content2: Arial;
  content3: 1px solid red; }

join() 函数:

.test3 {
    content1: join(10px 20px, 30px 40px);
    content2: join((blue, red), (#abc, #def));
 content3: join((blue, red), (#abc, #def), space);
}

转换为:

.test3 {
  content1: 10px 20px 30px 40px;
  content2: blue, red, #abc, #def;
  content3: blue red #abc #def; } 

append()函数:

.test4 {
    content1: append(10px 20px, 30px);
    content2: append((10px, 20px), 30px);
    content3: append(green, red);
    content4: append(red, (green, blue));
}

生成为:

.test4 {
  content1: 10px 20px 30px;
  content2: 10px, 20px, 30px;
  content3: green red;
  content4: red green, blue; }

zip()函数:

.test5 {
    content1: zip(1px 2px 3px, solid dashed dotted, green blue red);
}

生成为:

.test5 {
  content1: 1px solid green, 2px dashed blue, 3px dotted red; }

注意啦:使用zip时,每个单元的列表个数值必须相同,否则将会出错。

上一篇 下一篇

猜你喜欢

热点阅读