sass中的循环判断条件语句
@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中的循环判断条件语句的更多相关文章
- tips:Java中while的判断条件
tips:Java中while的判断条件! 在c++中,有时候会遇到这种情况: while(x = y){ dosomething; } 如果x与y相等,这个时候如果循环体中没有跳出的点,那么会无限循 ...
- jpa中使用Query判断条件查询
jpa中使用Query判断条件查询 @Query(value = " select m.* from mining_area as m " + " where 1 = 1 ...
- js 中的流程控制-条件语句
条件语句: if(exp)执行一句代码 <script> var x = 1 ; if(x == 1 ) //当if判断语句结果是true 或者 false 当判断结果等于true的时候, ...
- js中的运算符和条件语句
js中的运算符大体上可以分为4类:1算术运算符.2一元操作符.3比较运算符.4逻辑运算符. 算术运算符一般指的是加减乘除求余这五种操作符:+,-,*,/,%.通过算术运算符可以对js中的变量进行操作. ...
- R中的运算符,条件语句,控制语句
1.运算符 算术运算符:+,-,*,/ 关系运算符:==,!=,>,>=,<,<= 逻辑运算符:&,|,&&,||,! &和|称为短逻辑符,&a ...
- SqlServer中循环和条件语句
if语句使用示例 declare @a int set @a=12 if @a>100 begin ...
- SqlServer中循环和条件语句示例!
-- ╔════════╗ -- =============================== ║ if语句使用示例 ║ -- ╚════════╝ declare @a int set @a=12 ...
- SQL中循环和条件语句
.if语句使用示例: declare @a int begin print @a end else begin print 'no' end .while语句使用示例: declare @i int ...
- oracle pl/sql中的循环及if语句
for循环 /* for循环打印1到10 */ set serveroutput on; declare begin .. loop dbms_output.put_line(i); end loop ...
随机推荐
- 116A
#include <stdio.h> int main() { int n; int a1,a2; int min=0; int cap=0; scanf("%d",& ...
- [LeetCode] 124. Binary Tree Maximum Path Sum_ Hard tag: DFS recursive, Divide and conquer
Given a non-empty binary tree, find the maximum path sum. For this problem, a path is defined as any ...
- Java语言基础问题
1. 一个Java类文件中可以有几个公有类 在eclipse中测试代码时会出现上图所示的错误,此处只允许用final或abstract来修饰类,也就是一个类文件中只能有一个public修饰的类,此下对 ...
- python内置函数值 -- chr() ord()
chr()接收一个数字, 找到这个数字对应的ascii里的元素(只能接受数字) a = chr(65) print(a) #结果: A ord()接收一个字符,返回这个字符对应的数字.(只能接受一个字 ...
- python 参数解析ArgumentParser
#!/usr/bin/env python #coding:utf-8 from argparse import ArgumentParser #--------------------------- ...
- 已解决(转)关于android - apk(解析错误)解析程序包时出现问题
如果开发的应用用户较多,那么必须保证应用在多个版本不同的设备上能够正确的运行.这就要求对各个版本比较熟悉,知道在什么版本中加入了什么新的功能或特性.但是Android的版本太多了,是个令人头疼的问题. ...
- robot framework自定义python库
自定义python库的好处: robot framework填表式,将python的灵活性弄没了,但是不要担心,RF早就想到了解决办法,就是扩充自己的库. 1.在python应用程序包目录下创建一个新 ...
- EasyTouch中虚拟摇杆的使用EasyJoystick
unity3d自带的虚拟摇杆显然没有EasyTouch好用 首先下载这个插件 http://pan.baidu.com/s/1hqJAbTa 下载完成后.导入到unity,可以看看里面的案例
- Faster-rcnn实现目标检测
Faster-rcnn实现目标检测 前言:本文浅谈目标检测的概念,发展过程以及RCNN系列的发展.为了实现基于Faster-RCNN算法的目标检测,初步了解了RCNN和Fast-RCNN实现目标检 ...
- 29.html5 移动端开发总结
手机与浏览器 浏览器: 移动端开发主要针对手机,ipad等移动设备,随着地铁里的低头族越来越多,移动端开发在前端的开发任务中站的比重也越来越大.各种品牌及尺寸的手机也不尽相同.尺寸不同就算了分辨率,视 ...