sass08 if while for each
scss
@function getzIndex($layer: default){
$zindexMap: (default: 1, modal: 1000, dropdown: 500, grid: 300);
$zindex:;
@if map-has-key($zindexMap, $layer){
$zindex: map-get($zindexMap, $layer);
}
@return $zindex;
}
@debug getzIndex('afd');
//$layer可选:default,modal,dropdown,grid
$screenWidth: 500;
body{
color: if($screenWidth > 768, blue, red);//三目运算,没有@符号
}
@if $screenWidth > 768{
body{
color: red;
}
}
@else if $screenWidth >400{
span{
color: green;
}
}
@else{
p{
color: blue;
}
}
@for $i from 1 to 5{ //for语句
.span#{$i}{
width: 20% * $i;
}
}
$j: 6;
@while $j > 0{
.p#{$j}{
width: 20% * $j;
}
$j: $j - 3;
}
$k: 1;
@each $c in blue, red, green {
.div#{$k}{
color: $c; //$c是遍历的每一个值
}
$k: $k+1;
}
@each $key,$color in (default, blue), (info, green), (danger, red){
.text-#{$key}{
color: $color;
}
}
@each $key, $kk in (default: blue, info: green, danger: red){
.label-#{$key}{
color: $kk;
}
}
css
body {
color: red;
}
span {
color: green;
}
.span1 {
width: 20%;
}
.span2 {
width: 40%;
}
.span3 {
width: 60%;
}
.span4 {
width: 80%;
}
.p6 {
width: 120%;
}
.p3 {
width: 60%;
}
.div1 {
color: blue;
}
.div2 {
color: red;
}
.div3 {
color: green;
}
.text-default {
color: blue;
}
.text-info {
color: green;
}
.text-danger {
color: red;
}
.label-default {
color: blue;
}
.label-info {
color: green;
}
.label-danger {
color: red;
}
/*# sourceMappingURL=demo1.css.map */
sass08 if while for each的更多相关文章
随机推荐
- 洛谷 P2243 电路维修
P2243 电路维修 题目背景 Elf 是来自Gliese 星球的少女,由于偶然的原因漂流到了地球上.在她无依无靠的时候,善良的运输队员Mark 和James 收留了她.Elf 很感谢Mark和Jam ...
- shell如何更改当前工作路径
转载: http://imysqldba.blog.51cto.com/1222376/616805 shell 脚本执行有三种方法 bash 脚本名 sh 脚本名 chmod +x 脚本名 使用下面 ...
- POJ 1107
水题一道,注意取模时不能为0 #include <iostream> #include <algorithm> #include <cstring> #includ ...
- ftp for linux 配置
曾经配的熟悉的不能再熟悉了的东西,多年不用就忘了. 好真是好记性不如烂笔头.本文假如你已经安装好了, 1,ftp默认是不同意root用户登录的,假设要root用户登录,请例如以下改动:打开/etc/v ...
- Accessibility辅助控制类
熟悉Android开发的都知道辅助功能服务 Accessibility service.他的作用有非常多.360豌豆荚等应用市场的非root自己主动安装.微信抢红包插件.盲人辅助程序等等功能都是靠它实 ...
- Android中的单位
Android中的单位 1.px 像素(pixels) VGA 480*640像素 (Video Graphics Array) QVGA 240*320像素 (Quarter VGA) HVGA 3 ...
- 操作系统 之 哈希表 Linux 内核 应用浅析
1.基本概念 散列表(Hash table.也叫哈希表).是依据关键码值(Key value)而直接进行訪问的数据结构. 也就是说,它通过把关键码值映射到表中一个位置来訪问记录.以 ...
- JAVA性能优化的五种方式
一,JAVA性能优化之设计优化 设计优化处于性能优化手段的上层.它往往须要在软件开发之前进行.在软件开发之前,系统架构师应该就评估系统可能存在的各种潜在问题和技术难点,并给出合理的设计方案,因为软件设 ...
- 搞笑OI
OI难 噫吁嚱,维护难哉!OI之难,难于上青天!哈希及DP,代码何茫然!尔来一千两百A,不见金牌背后难.西当华师有考场,可以横绝CN巅.编译不过壮士死,然后超时爆内存相钩连.上有自主招生之高标,下有由 ...
- gist.github.com
hosts添加:192.30.253.118 gist.github.com