1、sass环境搭载:

安装ruby

安装sass

安装compass

配置webstorm

如果只是使用sass的话,就配置sass命名监听就好了

如图:

sass目录如下:

如果配置了compass要监听compass命令,如图:

compass目录如下:

2、基本语法:

@import "compass/css3";
@import "compass/layout";
@import "compass/typography";
@import "compass/utilities";
@import "compass";
.round{
@include border-radius(15px);
@include opacity(0.6);
@include inline-block;
@include sticky-footer(54px);
@include stretch;
}
a{
@include link-colors(#00c,#0cc,#c0c,#ccc,#cc0);
}
.clearfix{
@include clearfix;
}
table{
@include table-scaffolding;
}
.icon{
background:inline_image("grid.png");
}
#main {
width: 97%; p, div {
font-size: 2em;
a { font-weight: bold; }
}
p {
color: #00ff00;
width: 97%;
.redbox {
background-color: #ff0000;
color: #000000; }
}
pre { font-size: 3em; }
}
.funky {
font: {
family: fantasy;
size: 30em;
weight: bold;
color:#123456;
}
}
#context a%extreme {
color: blue;
font-weight: bold;
font-size: 2em;
}
.notice {
@extend %extreme;
}

编译之后:

/* line 6, ../sass/test.scss */
.round {
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
border-radius: 15px;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=60);
opacity: 0.6;
display: inline-block;
vertical-align: middle;
*vertical-align: auto;
*zoom:;
*display: inline;
position: absolute;
top:;
bottom:;
left:;
right:;
}
/* line 10, C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/layout/_sticky-footer.scss */
.round html, .round body {
height: 100%;
}
/* line 12, C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/layout/_sticky-footer.scss */
.round #root {
clear: both;
min-height: 100%;
height: auto !important;
height: 100%;
margin-bottom: -54px;
}
/* line 18, C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/layout/_sticky-footer.scss */
.round #root #root_footer {
height: 54px;
}
/* line 20, C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/layout/_sticky-footer.scss */
.round #footer {
clear: both;
position: relative;
height: 54px;
} /* line 13, ../sass/test.scss */
a {
color: #00c;
}
/* line 18, C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/typography/links/_link-colors.scss */
a:visited {
color: #ccc;
}
/* line 21, C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/typography/links/_link-colors.scss */
a:focus {
color: #cc0;
}
/* line 24, C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/typography/links/_link-colors.scss */
a:hover {
color: #0cc;
}
/* line 27, C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/typography/links/_link-colors.scss */
a:active {
color: #c0c;
} /* line 16, ../sass/test.scss */
.clearfix {
overflow: hidden;
*zoom:;
} /* line 2, C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/utilities/tables/_scaffolding.scss */
table th {
text-align: center;
font-weight: bold;
}
/* line 5, C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/utilities/tables/_scaffolding.scss */
table td,
table th {
padding: 2px;
}
/* line 8, C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/compass-core-1.0.3/stylesheets/compass/utilities/tables/_scaffolding.scss */
table td.numeric,
table th.numeric {
text-align: right;
} /* line 22, ../sass/test.scss */
.icon {
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAASCAYAAAApH5ymAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAABISURBVEiJY3zx/vd/hgEA4gIsRKljorE7KAajDqQUjDqQUjDqQErBqAMpBaMOpBSMOpBSMOpASsGgdyAL4693A2Lxq1fEqQMATrMH3/OsPu4AAAAASUVORK5CYII=');
} /* line 25, ../sass/test.scss */
#main {
width: 97%;
}
/* line 28, ../sass/test.scss */
#main p, #main div {
font-size: 2em;
}
/* line 30, ../sass/test.scss */
#main p a, #main div a {
font-weight: bold;
}
/* line 32, ../sass/test.scss */
#main p {
color: #00ff00;
width: 97%;
}
/* line 35, ../sass/test.scss */
#main p .redbox {
background-color: #ff0000;
color: #000000;
}
/* line 39, ../sass/test.scss */
#main pre {
font-size: 3em;
} /* line 41, ../sass/test.scss */
.funky {
font-family: fantasy;
font-size: 30em;
font-weight: bold;
font-color: #123456;
} /* line 49, ../sass/test.scss */
#context a.notice {
color: blue;
font-weight: bold;
font-size: 2em;
}

重点是五个模块

@import "compass/css3";
@import "compass/layout";
@import "compass/typography";
@import "compass/utilities";
@import "compass";
宏定义:@include
继承虚拟类:
@extend %

sass或scss入门的更多相关文章

  1. Sass介绍及入门教程

    Sass是什么? Sass是"Syntactically Awesome StyleSheets"的简称.那么他是什么?其实没有必要太过于纠结,只要知道他是“CSS预处理器”中的一 ...

  2. scss 入门

    scss 入门 1. scss 引入其他文件 引入其他 .scss 文件 @import 'index.scss' 这样的话,文件在编译后,会自动把引入的文件和当前文件合并为一个. scss 文件 引 ...

  3. scss 入门基础

    在一个项目中,样式是必不可少的一部分,而对于一个完整的项目来说是有个基准色调的.在项目需求变化不大的情况下,可以直接在css中写这些颜色值之类的东西.但是如果遇到一个朝令夕改的领导或者甲方,那会变得相 ...

  4. scss入门学习(一)

    sass的文件后缀名 sass是目前流行的css预处理语言.sass有两种后缀文件,一种是.sass,不允许使用大括号和分号:另一种是.SCSS,允许使用大括号和分号,类似于我们平时写css的语法习惯 ...

  5. Sass和Compass入门

    一.前言 1.Sass是什么? Sass可以简化你的Css工作流,并可以使你的Css的扩展和维护工作变的更加容易!例如,曾几时何,因为客户的需求的变更,你必须不断的通过查找和替换来更改一个像素值,或者 ...

  6. 【已解决】React中配置Sass引入.scss文件无效

    React中配置Sass引入.scss文件无效 在react中使用sass时,引入.scss文件失效 尝试很多方法没法解决,最终找到解决方法,希望能帮助正在坑里挣扎的筒子~ 在node_modules ...

  7. sass和scss的区别

    页面引入的时候还是引入的css文件 因为sass和scss都是一种css的预处理工具 目的最后都是生成css文件 sass不带{}和:是基于Ruby 写出来的,严格的缩进方式来控制 scss带这两个 ...

  8. 1-1 sacc(scss)入门

    定义: CSS 预处理器定义了一种新的语言,其基本思想是,用一种专门的编程语言,为 CSS 增加了一些编程的特性,将 CSS 作为目标生成文件,然后开发者就只要使用这种语言进行编码工作. 通俗的说,“ ...

  9. sass和scss相关知识

    参考地址:http://www.imooc.com/learn/311 什么是css预处理器? CSS 预处理器定义了一种新的语言,其基本思想是,用一种专门的编程语言,为 CSS 增加了一些编程的特性 ...

随机推荐

  1. Spring DM所提供的Bundle监听接口OsgiBundleApplicationContextListener

    通过使用Spring DM提供的监听接口,我们可以更好的对服务进行管控,其实该接口也非常简单就能使用上,只要自定义一个类实现OsgiBundleApplicationContextListener接口 ...

  2. .net学习网站汇总

    http://chs.gotdotnet.com/quickstart/简介:本站点是微软.NET技术的快速入门网站,我们不必再安装.NET Framework中的快速入门示例程序,直接在网上查看此示 ...

  3. selenium框架与chrome浏览器的不兼容问题

    在一次偶然的情况下,在chrome上用selenium框架去抓取某个id为XX的页面元素,使用WebDriver的findElement().click()方法进行点击,原来在firefox浏览器运行 ...

  4. iOS arc下控制某一文件为非arc

    选中文件加上编译参数 -fno-objc-arc即可.

  5. 新学到的xss姿势,分享一下

    在js中有一种神奇的对象叫做window 当页面中包含如类似的 <script>var c = urlQuery("callback"); var r = JSON.p ...

  6. Nginx+tomcat动静分离安装脚本

    #!/bin/bashsetenforce 0systemctl stop firewalldtar -zxvf nginx-1.8.0.tar.gz -C /usr/src/ cd /usr/src ...

  7. 每天一个Linux命令(13)--less命令

    less 工具也是对文件或其它输出进行分页显示的工具,应该说是Linux正统馋看文件内容的工具,功能极其强大.less 的用法比起  more 更加有弹性.  在 more 的时候,我们没有办法向前面 ...

  8. WebStorm 自定义字体+颜色+语法高亮+导入导出用户设置

    WebStorm :是jetbrains公司旗下一款JavaScript 开发工具.被广大中国JS开发者誉为“Web前端开发神器”.“最强大的HTML5编辑器”.“最智能的JavaScript IDE ...

  9. java基础:数组的拼接

  10. 如何修改SVN客户端中保存的密码

    本文主要讲述Linux命令行下怎么修改已经保存的客户端密码: 第一步,删除 subvision文件: rm -rf ~/.subvision 第二步:执行任意需要访问服务器的svn命令,会提示是否永久 ...