Syntactically Awesome Stylesheets
Data Abstraction
Encapsulation/Modularity
Expressivity
How many of these are missing from CSS?
http://sass-lang.com
Set up an account now and play along!!
For each of the following slides,
$font-stack: Helvetica, sans-serif;
$primary-color: #333;
body {
font: 100% $font-stack;
color: $primary-color;
}
nav {
ul {
margin: 0;
padding: 0;
list-style: none;
}
li { display: inline-block; }
a {
display: block;
padding: 6px 12px;
text-decoration: none;
&:hover {
color: blue;
}
}
}
Imported into another Sass file using the @import directive.
// _reset.scss html, body, ul, ol { margin: 0; padding: 0; }
// base.scss @import 'reset';
$font-stack: Helvetica, sans-serif;
$primary-color: #333;
body {
font: 100% $font-stack;
color: $primary-color;
}
@mixin border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
border-radius: $radius;
}
.box { @include border-radius(10px); }
.message { border: 1px solid #ccc; padding: 10px; color: #333; } .success { @extend .message; border-color: green; } .error { @extend .message; border-color: red; } .warning { @extend .message; border-color: yellow; }
.container { width: 100%; } article[role="main"] { float: left; width: 600px / 960px * 100%; } aside[role="complimentary"] { float: right; width: 300px / 960px * 100%; }
@import resetfinds
_reset.scss
Watch:
Read: