列表函數(shù):
- length($list): 返回一個(gè)列表的長(zhǎng)度;
- nth(
n):返回一個(gè)列表中指定的某個(gè)標(biāo)簽值纱耻;nth()函數(shù)和其他語言不同芭梯,1是指列表中的第一個(gè)便簽值,2是指列表中第二個(gè)標(biāo)簽值弄喘,依此類推玖喘;$n必須是大于0的整數(shù)。
- join(
list2,[separator]):將兩個(gè)列連接在一起蘑志,成為一個(gè)列表累奈;join只能連接兩個(gè)列表贬派;$separator參數(shù)用來指定列表使用什么方式倆分隔各項(xiàng),comma(逗號(hào))或space(空格)澎媒;
- append(
val,[$separator]):將某個(gè)值放在列表的最后搞乏;
- zip($lists…):將幾個(gè)列表結(jié)合成一個(gè)多維列表;
- index(
value) :返回一個(gè)值在列表中的位置戒努。
length() 函數(shù):
.test1 {
content1: length(1px);
content2: length(1px 2px);
content3: length(10px 20px (border 1px solid) 2em);
}
生成為:
.test1 {
content1: 1;
content2: 2;
content3: 4; }
nth() 函數(shù):
.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() 函數(shù):
.test3 {
content1: join(10px 20px, 30px 40px);
content2: join((blue, red), (#abc, #def));
content3: join((blue, red), (#abc, #def), space);
}
轉(zhuǎn)換為:
.test3 {
content1: 10px 20px 30px 40px;
content2: blue, red, #abc, #def;
content3: blue red #abc #def; }
append()函數(shù):
.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()函數(shù):
.test5 {
content1: zip(1px 2px 3px, solid dashed dotted, green blue red);
}
生成為:
.test5 {
content1: 1px solid green, 2px dashed blue, 3px dotted red; }
注意啦:使用zip時(shí)请敦,每個(gè)單元的列表個(gè)數(shù)值必須相同,否則將會(huì)出錯(cuò)柏卤。