@lilianakastilio
Syntactically Awesome Style Sheets
You can use variables to store info you want to reuse throughout your stylesheet:
$brand-color: #fcfcfc;
.title-heading {
color: $brand-color;
}
You can set your variable to equal another variable!
$white: fcfcfc;
$brand-color: $white;
.title-heading {
color: $brand-color;
}
Multiple variables at once 😱
$button-border-color: #3c3c3c;
$button-border-style: solid;
$button-border-size: 1px;
.super-awesome-button {
border: $button-border-size $button-border-style $button-border-color;
}
Get organised!
@import '_partial.scss';
Extending/Inheriting properties
Example
.message {
text-align: center;
color: white;
padding: 6px 8px;
}
.error {
@extends message;
color: red;
}
.success {
@extends message;
color: green;
}
Tidy code ❤️
You can nest your selectors to keep things organised!
.footer {
background: black;
.link {
color: pink;
}
}
.footer {
background: black;
}
.footer .link {
color: pink;
}
}
SASS
CSS
Use math operators in your Sass!
$main-body-width: 100%;
$sidebar-width: 400px;
.sidebar {
display: inline-block;
width: $sidebar-width;
.main-body {
display: inline-block;
max-width: 100% - $sidebar-width;
}
There is a special use for &
.button {
&:visited { }
&:hover { }
&:active { }
}
.button { }
.button:visited { }
.button:hover { }
.button:active { }
Twitter: @lilianakastilio
Blog: blog.lilianakastilio.co.uk