@if

$lte7:true !default;//是否兼容ie6,7 //inline-block //ie6-7 *display: inline;*zoom:1;

@mixin inline-block {

  display: inline-block;

   @if $lte7 {

    *display: inline;*zoom:1;

  }

}

既然有@if,那肯定有@else啊

$filter:false !default; //是否开启ie滤镜 //背景色半透明

@mixin bgcolor-alpha($bgcolor: rgba(0,0,0,.5)){

  color:#fff;

  @if $filter{

      filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#{ie-hex-str($bgcolor)}', endColorstr='#{ie-hex-str($bgcolor)}');

  }

  @else{

    background-color: #333;

  }

  background-color:$bgcolor;

}

sass的@if用not,or,and分别表示非,或,与。

$a: false !default;

$b: true !default;

@if not($a){

  p{ color:red; }

}

div{

  font-size:14px;

  @if $a or $b{

     width:300px;

  }

}

li{

   line-height:24px;

  @if $a and $b{

    float:left;

   }

}

sass用==,!=分别表示等于与不等于。

@for

for循环有两种形式,分别为:@for $var from through 和@for $var from to 。

$i表示变量,start表示起始值,end表示结束值,这两个的区别是关键字through表示包括end这个数,而to则不包括end这个数。先来个简单的:

@for $i from 1 through 3 {

  .item-#{$i} {

    width: 2em * $i;

   }

}

@each

语法:@each $var in

@each $animal in puma, sea-slug, egret, salamander {

  .#{$animal}-icon {

    background-image: url('/images/#{$animal}.png');

  }

}

sass中的循环判断条件语句的更多相关文章

  1. tips:Java中while的判断条件

    tips:Java中while的判断条件! 在c++中,有时候会遇到这种情况: while(x = y){ dosomething; } 如果x与y相等,这个时候如果循环体中没有跳出的点,那么会无限循 ...

  2. jpa中使用Query判断条件查询

    jpa中使用Query判断条件查询 @Query(value = " select m.* from mining_area as m " + " where 1 = 1 ...

  3. js 中的流程控制-条件语句

    条件语句: if(exp)执行一句代码 <script> var x = 1 ; if(x == 1 ) //当if判断语句结果是true 或者 false 当判断结果等于true的时候, ...

  4. js中的运算符和条件语句

    js中的运算符大体上可以分为4类:1算术运算符.2一元操作符.3比较运算符.4逻辑运算符. 算术运算符一般指的是加减乘除求余这五种操作符:+,-,*,/,%.通过算术运算符可以对js中的变量进行操作. ...

  5. R中的运算符,条件语句,控制语句

    1.运算符 算术运算符:+,-,*,/ 关系运算符:==,!=,>,>=,<,<= 逻辑运算符:&,|,&&,||,! &和|称为短逻辑符,&a ...

  6. SqlServer中循环和条件语句

    if语句使用示例 declare @a int              set @a=12              if @a>100                 begin      ...

  7. SqlServer中循环和条件语句示例!

    -- ╔════════╗ -- =============================== ║ if语句使用示例 ║ -- ╚════════╝ declare @a int set @a=12 ...

  8. SQL中循环和条件语句

    .if语句使用示例: declare @a int begin print @a end else begin print 'no' end .while语句使用示例: declare @i int ...

  9. oracle pl/sql中的循环及if语句

    for循环 /* for循环打印1到10 */ set serveroutput on; declare begin .. loop dbms_output.put_line(i); end loop ...

随机推荐

  1. Windows平台Mysql表名变小写的解决过程

    由于要弄某个项目的数据库设计文档,几百张表,如果弄在word文档里面一个个添加,效率比较低. 故分别使用了Mysql WorkBench(win版)和Powerdesigner 15来做这个设计文档. ...

  2. localhost/get/user.json localhost/get/user.xml

    我也是引入了jackson-dataformat-xml这个依赖,它是提供了jackson将实体类转化为xml相关的作用.而本身jackson是可以将实体类转化为json的,所以这样Jackson是可 ...

  3. tortoiseSVN版本合并(merge)

    原文地址:http://blog.163.com/qq371557620@yeah/blog/static/8428365820172110320574/ 编码过程中,我们经常会遇到需要多个分支并行开 ...

  4. golang fmt格式“占位符”

    # 定义示例类型和变量 type Human struct { Name string } var people = Human{Name:"zhangsan"} 普通占位符 占位 ...

  5. extjs store快速创建的几种方式

    viewModel中定义stores: { tickets: { model: 'Ticket', autoLoad: true, remoteFilter: true, filters: [{ pr ...

  6. jenkins 常用插件和配置项介绍和使用

    jenkins 上搜索不到的插件可以在如下地址下载: http://updates.jenkins-ci.org/download/plugins/ 1.Notification Plugin 介绍: ...

  7. python string method

    嗯,学习其它语言没这样全练过,嘻嘻 //test.py 1 # -*- coding: UTF-8 -*- 2 3 str = "i am worker" 4 print str. ...

  8. 第一章入门篇CSS样式的分类、盒模型

    1.CSS样式的分类 CSS样式分为一项4种: 1.内联样式表,直接写在元素style属性里面的样式,如 <p style="color:red;">内联样式</ ...

  9. Selenium基础知识(七)弹出框处理

    使用switch_to.alert方法来处理弹页面弹出的警告框 页面常见警告框种类:alert/confirm 确认框/prompt switch_to.alert().accept() switch ...

  10. UVAL 4728 Squares(旋转卡壳)

    Squares [题目链接]Squares [题目类型]旋转卡壳 &题解: 听着算法名字,感觉挺难,仔细一看之后,发现其实很简单,就是依靠所构成三角行面积来快速的找对踵点,就可以省去很多的复杂 ...