scss基础教程
2016-08-23 17:17
211 查看
细节注意:
scss编译工具:koala
示例目录结构:
文件内容详细:
index.html:
参考文章:
sass语法
关于sass那些事,sass用法
.a { $w1: 16px; $w2: 6px; top: $w1-$w2;/* 错误写法 */ top: $w1+(-$w2);/* 正确写法 */ }
scss编译工具:koala
示例目录结构:
文件内容详细:
index.html:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"> <meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″/> <title>scss</title> <link rel="stylesheet" href="css/app.css"> </head> <body> <div class="a"> 1 <div class="b"> 2 <div class="d">5</div> </div> 3 </div> <div class="c">4</div> <script> </script> </body> </html>variable.scss:
$bgcolor: grey;mixin.scss:
@mixin border($color: yellow, $p: 10px) { display: inline-block; border: 2px solid $color; padding: $p; }app.scss:
/** * MAIN * app * * BASE * variable * mixin * */ @import "variable", "mixin";//调用 * { margin: 0; padding: 0; } div { @include border($color: red); } .a { padding: 5px; background: $bgcolor; .b { color: hsl(270, 100%, 50%); .d { font: { size: 30px; weight: bold; family: "Microsoft Yahei"; } } } } .c { @extend .b; } %e { background: purple; } .c { @extend %e; }app.css(该文件由koala自动编译生成):
/** * MAIN * app * * BASE * variable * mixin * */ * { margin: 0; padding: 0; } div { display: inline-block; border: 2px solid red; padding: 10px; } .a { padding: 5px; background: grey; } .a .b, .a .c { color: #7f00ff; } .a .b .d, .a .c .d { font-size: 30px; font-weight: bold; font-family: "Microsoft Yahei"; } .c { background: purple; }
参考文章:
sass语法
关于sass那些事,sass用法
相关文章推荐
- JavaScript 基础教程
- 零基础易语言入门教程(三)之了解控制台程序
- 软件架构训练基础教程之C/S技术
- 软件架构训练基础教程之面向组件技术
- [软件架构训练基础教程-4]技术所有权
- [软件架构训练基础教程-1]导语
- 软件架构训练基础教程之Intenet技术
- 软件架构训练基础教程之导语
- 软件架构训练基础教程之层次及使用
- JavaScript 基础教程
- 色彩系列教程(1):基础知识
- 软件架构训练基础教程之面向对象技术
- JDBC基础教程之ResultSet对象
- Asp基础教程(上)
- JavaScript 基础教程(2)
- Multi-Tier结构程序开发基础教程 (二)
- VML,XML,SVG基础教程
- 软件架构训练基础教程之Intenet技术
- [软件架构训练基础教程-3]面向组件技术
- [软件架构训练基础教程-5]C/S技术