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 ...
随机推荐
- 4 jmeter badboy脚本开发技术详解
badboy中的检查点 以www.sogou.com搜索为例演示,搜索badboy. 1.打开badboy工具,点击红色按钮开始录制,在地址栏目中输入地址:www.sogou.com,回车. 2.输入 ...
- 关于获取路径path
String webPath = request.getServletPath(); log.info(webPath); 输出: /zjdlbb/zjdlbb/zjdlbb/test.ht log. ...
- jsp fmt标签格式化double数字
<fmt:formatNumber value="${zjdl.ygdl }" pattern="0.00" />
- VueI18n的应用
.npm install vue-i18n .在 main.js 中引入 vue-i18n import VueI18n from 'vue-i18n' Vue.use(VueI18n) .在main ...
- 微信小程序https发起请求失败的解决方法
https://blog.csdn.net/yuhui123999/article/details/60572888 https://blog.csdn.net/yuhui123999/article ...
- Centos7配置JAVA_HOME
Centos7配置JAVA_HOME http://blog.csdn.net/zzpzheng/article/details/73613838 在Centos7上,通过yum install ja ...
- SaltStack 安装配置 centos7
参考文档 http://docs.saltstack.cn/contents.html 快速安装 初始配置 控制端master配置 # vim /etc/salt/master interface: ...
- 一个基于JRTPLIB的轻量级RTSP客户端(myRTSPClient)——实现篇:(七)RTP音视频传输解析层之H264传输格式
一.H264传输封包格式的2个概念 (1)组包模式(Packetization Modes) RFC3984中定义了3种组包模式:单NALU模式(Single Nal Unit Mode).非交错模式 ...
- [Leetcode] Template to rotate matrix
Rotate the image by 90 degrees (clockwise). Given input matrix = [ [1,2,3,4], [5,6,7,8], [9,10,11,12 ...
- SSH管理
Netcat, ProxyCommand, ssh config 之前一直使用密码登录,但是也是可以免密码登录的,只要你使用,在服务器端生产rsa加密密钥,再使用ssh-copy-id命令,把自己本地 ...