sass09
scss
/*
1、使用自定义function和@each实现栅格布局。
@function buildLayout($num: 5){ } 结果:
col1{width: 20%}
col2{width: 40%}
...
*/ @function buildLayout($num: 5){
$map:(defaultValue:0);
$rate:percentage(1 / $num);
@for $i from 1 through $num{
$tmpMap:(col#{$i}: $rate * $i);
$map:map-merge($map,$tmpMap);
}
$map:map-remove($map,defaultValue);
@return $map;
} @mixin buildLayout($num:5){
$map:buildLayout($num);
@each $key,$value in $map{
.#{$key}{
width:$value;
}
}
}
@include buildLayout(10);
@debug buildLayout(10);
css
@charset "UTF-8";
/*
1、使用自定义function和@each实现栅格布局。
@function buildLayout($num: 5){ } 结果:
col1{width: 20%}
col2{width: 40%}
...
*/
.col1 {
width: 10%;
} .col2 {
width: 20%;
} .col3 {
width: 30%;
} .col4 {
width: 40%;
} .col5 {
width: 50%;
} .col6 {
width: 60%;
} .col7 {
width: 70%;
} .col8 {
width: 80%;
} .col9 {
width: 90%;
} .col10 {
width: 100%;
} /*# sourceMappingURL=demo1.css.map */
sass09的更多相关文章
随机推荐
- java源码之TreeMap
Map的单元是对键值对的处理,之前分析过的两种Map,HashMap和LinkedHashMap都是用哈希值去寻找我们想要的键值对,优点是理想情况下O(1)的查找速度. 那如果我们在一个对查找性能要求 ...
- Nginx +Tomcat 实现动静态分离(转)
Nginx +Tomcat 实现动静态分离 动静态分离就是Nginx处理客户端的请求的静态页面(html页面)或者图片,Tomcat处理客户端请求的动态页面(jsp页面),因为Nginx处理的静态页面 ...
- C++实现页码数字统计
#include<iostream> #include<iomanip> #include<cstdlib> #include<ctime> #incl ...
- [Tools] Create your own mobile emulator device by using Chrome dev tool
Using the New Device Emulation Interface The Device Emulation interface changed a bit with the newer ...
- NYOJ 815 三角形【海伦公式】
/* 关键点:海伦公式 解题人:lingnichong 解题时间:2014-10-04 21:48:47 解题体会:海伦公式的使用 */ 三角形 时间限制:1000 ms | 内存限制:65535 ...
- 扩展MARA 加入Z字段BAPI_TE_MARA
1. 在MARA中APPEND新的结构 2.在BAPI_TE_MARA中APPEND新的结构 (可是这里不能有QUAN,CURR,DEC等数据类型) 3.在BAPI_TE_MARAX中APPEND新的 ...
- MySQL超级简明基本操作攻略,给自己看(一)
系统:Ubuntu 14.04 LTS 安装: apt-get install mysql //安装数据库 apt-get install mysql-workbench //安装图形界面 使用: 启 ...
- Apicloud自定义模块
各种坑,折腾了两天才有点头绪.我用的是Android Studio编辑器,官网是Eclipse的视频.文档也比较蛋疼. 自定义模块的目录结构要按照下面来处理 其中res_模块名,存放res和Andro ...
- m_Orchestrate learning system---六、善用组件插件的好处是什么
m_Orchestrate learning system---六.善用组件插件的好处是什么 一.总结 一句话总结: 1.面包屑导航是什么? 知道它是什么自然就知道它怎么用了 2.表格里面的栏目能能点 ...
- Windows 10 Mobile 演示:插入耳机自动执行 APP
Windows Mobile 10 新特性:插入外部设备自动动作(如插入耳机执行 APP.打开小工具):另外可以找到最后一次使用设备地点和时间: http://www.tudou.com/progra ...