导入scss

@import "../../sass/variables.scss";
@import "../../sass/helper.scss";

@mixin

@mixin flex ($a, $b) {
display: flex;
justify-content: $a;
align-items: $b;
}

使用:@include flex(flex-start, center);

@function

$base-font-size: 75px;
@function pxToRem($px) {
@return $px / $base-font-size * 1rem;
}

使用: font-size: pxToRem(50px);

@if

@mixin position ($top, $right, $bottom, $left) {
position: absolute;
@if $top {
top: $top;
}
@if $right {
right: $right;
}
@if $bottom {
bottom: $bottom;
}
@if $left {
left: $left;
}
}

@include position(false,false,30rpx, 30rpx);

@if or / and

@mixin flex ($x: false, $y: false, $direction: false) {
display: flex; @if $x {
@if $x == s or $x == start {
justify-content: flex-start;
} @else if $x == c or $x == center {
justify-content: center;
} @else if $x == e or $x == end {
justify-content: flex-end;
} @else if $x == a or $x == around {
justify-content: space-around;
} @else if $x == b or $x == between {
justify-content: space-between;
} @else {
justify-content: $x;
}
} @if $y {
@if $y == s or $y == start {
align-items: flex-start;
} @else if $y == c or $y == center {
align-items: center;
} @else if $y == e or $y == end {
align-items: flex-end;
} @else if $y == stretch or $y == full or $y == f {
align-items: stretch;
} @else if $y == baseline or $y == base or $y == b or $y == line or $y == l {
align-items: baseline;
} @else {
align-items: $y;
}
} @if $direction {
flex-direction: $direction;
}
}

默认参数

@mixin flex ($a: false, $b: false, $c:false) {
display: flex;
@if $a {
justify-content: $a;
}
@if $b {
align-items: $b;
}
@if $c {
flex-direction: $c;
}
}

@for 循环

@for $i from  through  {
$em: if($i == , $i/, $i - ) + em;
.u-m-#{$i}{margin: #{$em}}
.u-mt-#{$i}{margin-top: #{$em}}
.u-mr-#{$i}{margin-right: #{$em}}
.u-mb-#{$i}{margin-bottom: #{$em}}
.u-ml-#{$i}{margin-left: #{$em}}
.u-pt#{i}{padding: #{$em}}
.u-pt-#{$i}{padding-top: #{$em}}
.u-pr-#{$i}{padding-right: #{$em}}
.u-pb-#{$i}{padding-bottom: #{$em}}
.u-pl-#{$i}{padding-left: #{$em}}
}

sass 的学习的更多相关文章

  1. sass入门学习篇(一)

    先简单的介绍一下sass,如果你了解less,sass就没什么太大问题 Sass 是对 CSS 的扩展,让 CSS 语言更强大.优雅. 它允许你使用变量.嵌套规则. mixins.导入等众多功能, 并 ...

  2. sass个人学习笔记

    Materliu 在慕课的视频: http://www.imooc.com/learn/364 . http://www.imooc.com/wiki/371 sass入门:http://www.w3 ...

  3. sass基础学习(一)

    移动端布局各种问题 pc端布局各种问题sass 组件模块化面向对象编程ajax 框架学习 webpack 打包 性能优化 gulp是基于Nodejs的自动任务运行器她能自动化地完成 javascrip ...

  4. sass的学习笔记

    sass初学入门笔记(一) 我本身是个新手,一边学sass一边记下的笔记,可能有点罗嗦,但是复习起来的话还是比较全面直观的.当然,最重要的还是去实践,实践得真理 其它 CSS 预处理器语言: CSS ...

  5. sass,compass学习笔记总结

    最近在进行百度前端技术学院的任务,知道自己基础薄弱,可没想到弱到这种地步,同时在安装各种软件的同时遇到了各种坑,查阅了各种资料,一个个解决的时候也发现自己凌乱了.学习总结,在脑海中形成自己的学习系统才 ...

  6. Sass的学习

    第一章:Sass简介 一. 什么是CSS预处理器 定义:CSS预处理器定义了一种新的语言,其基本思想是,用一种专门的编程语言,为CSS增加一些编程的特性,将CSS作为目标生成文件,然后开发者就只要使用 ...

  7. Sass&Compass学习笔记(一)

    1.sass中可以使用变量 变量名以$符号开头,可包含所有可用作CSS类名的字符,包括下划线和中划线. 可见,中划线也是可以作为命名的字符,这是与很多其他语言的不同之处.变量的使用实例: $compa ...

  8. sass基础学习

    2015.6.281.安装ruby2.运行gem安装sass-->gem install sass3.编译命令行sass --watch 文件路径/test.scss:编译后文件路径/test. ...

  9. sass入门学习篇(二)

    从语法开始但是语法也不是一两句的事情,首先看基本的导入,使用 一,sass有两种后缀名文件:一种后缀名为sass,不使用大括号和分号:另一种就是我们这里使用的scss文件,建议scss. 二,导入 使 ...

随机推荐

  1. Codeforces Beta Round #2 C. Commentator problem 模拟退火

    C. Commentator problem 题目连接: http://www.codeforces.com/contest/2/problem/C Description The Olympic G ...

  2. iOS \U6b3e转字符串

    -(NSString *)replaceUnicode:(NSString *)unicodeStr { NSString *tempStr1 = [unicodeStr stringByReplac ...

  3. PVS-Studio静态通用分析规则

    通用分析 PVS - Studio产品包含了一套通用静态分析规则,用于检测在C / C ++/ C+11应用程序中大范围内的各种缺陷. 通用的规则集帮助您发现逻辑错误,拼写错误,导致访问冲突的代码片段 ...

  4. Ceph源码解析:CRUSH算法

    1.简介 随着大规模分布式存储系统(PB级的数据和成百上千台存储设备)的出现.这些系统必须平衡的分布数据和负载(提高资源利用率),最大化系统的性能,并要处理系统的扩展和硬件失效.ceph设计了CRUS ...

  5. mysql5.7.x 编译安装

    一.卸载mariadb [root@mysql5 ~]# rpm -qa mariadb* mariadb-libs--.el7.centos.x86_64 [root@template tools] ...

  6. ISP图像调试工程师——自动曝光(熟悉3A算法)

    基于图像的自动曝光算法研究 : https://wenku.baidu.com/view/c854fa93fd0a79563c1e72ba.html

  7. poj3592 Instantaneous Transference tarjan缩点+建图

    //给一个n*m的地图.坦克从(0 , 0)開始走 //#表示墙不能走,*表示传送门能够传送到指定地方,能够选择也能够选择不传送 //数字表示该格的矿石数, //坦克从(0,0)開始走.仅仅能往右和往 ...

  8. Azkaban配置

    1,新建azkaban目录,用于安置azkaban程序 2,azkaban web服务器安装  解压 azkaban-web-server-2.5.0.tar.gz tar -zvxf azkaban ...

  9. Codeforces 112A-Petya and Strings(实现)

    A. Petya and Strings time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  10. HttpServletRequest和HttpServletResponse详解

    请求与响应相关的类和接口非常多,下表是主要的与请求和接口相关的类以及接口. 主要的与请求和接口相关的类及接口 方    法 说    明 ServletInputStream Servlet的输入流 ...