SlideShare a Scribd company logo
Getting Sassy
with CSS
Julie Cameron
@jewlofthelotus
#SassyCSS
bit.ly/getting-sassy
DERP.
I <3 PAIR PROGRAMMING
Getting Sassy with CSS
Getting Sassy with CSS
Syntactically Awesome Stylesheets
NOT an
acronym…
Syntactically Awesome Stylesheets
NOT
SASS
dot com
“If you see something, say something.
Only you can prevent overcapitalization.”
Hampton Catlin, Creator Of Sass
Just don’t be a
#Sasshole
about it. :)
Welcome to the
Sass
community!!
What Is Sass?
1. An extension of CSS
SassScript Language. Fully CSS-compatible syntax.
What Is Sass?
1. An extension of CSS
SassScript Language. Fully CSS-compatible syntax.
2. A CSS preprocessor
SassScript MAGIC CSS
Where Did Sass Come From?
• 2007: Designed by
Hampton Catlin (Haml)
• Developed by Chris
Eppstein (Compass) and
Natalie Weizenbaum
Why Did They Make Sass?
Because vanilla CSS just
wasn’t cutting it any more.
Bert Bos, CSS Co-Inventor
CSS stops short of even more powerful
features […]. That is because these things
give power-users a lot of rope, but less
experienced users will unwittingly hang
themselves; or, more likely, be so scared
that they won’t even touch CSS.
“
What Does Sass Give
Us That CSS Doesn’t?
• Nesting
• Imports
• Variables
• Mixins
• Inheritance
• Functions
• Loops
• AWESOME
What Does Sass Give
Us That CSS Doesn’t?
• Reduced Repetition
• Cleaner Modularity
• Maintainability
• Scalability
• REAL PROGRAMMING!
Setup & Workflow
Sass Installation
Ruby
OS X? Lucky you, it’s preinstalled!
Windows? Try RubyInstaller.
Sass
$ gem install sass
Sass Installation
LibSass (C/C++)
sass-lang.com/libsass
Compiling Sass
Sass CSS
$ sass source.sass output.css
$ sass source_dir output_dir
MAGIC
Sass Is Watching You
$ sass —-watch source.sass:output.css
This is the best thing. Ever.
Gotchya: Colon vs. Space
Two Sass Syntaxes
Sassy CSS .scss
Default; Valid CSS == Valid SCSS
Indented .sass
Original syntax; Haml-esque
The Good Stuff
Or, Why You’ll Never Write Plain Old CSS Again.
NESTING
Nesting
HTML has a clear hierarchy - elements are nested.
We can apply the same concept in Sass.
HTML Sass
Nesting Output
MAGIC
Sass CSS
Nesting Gotchya
Mirroring HTML nesting is
SUPER easy.
MAGIC?
Overly verbose and overly specific.
General Rule:
No more than 2-3 levels deep
Sass
CSS
Nesting The Parent Selector
You can reference parent selector(s) with an &
MAGIC
Sass CSS
Nesting The Parent Selector
The & can follow other selectors, too!
MAGIC
Sass
CSS
Sass
Nesting The Parent Selector
You can also append a suffix to the &!
MAGIC
CSS
Nesting Media Queries
MAGIC
THIS IS FREAKING AWESOME.
Sass CSS
Note: Matching media queries will
not group together in the output.
IMPORTS
AND ORGANIZATION
Imports
CSS @import has always
meant an extra file download.
Sass (application.scss)
Sass modifies @import to
instead include the resource
during compilation, rather
than on the client side.
Imports File Structure
• project_awesome
• sass
• lib
• fontawesome.scss
• base.scss
• grid.scss
• application.scss
• css
Sass
Imports File Structure
• project_awesome
• sass
• lib
• fontawesome.scss
• base.scss
• grid.scss
• application.scss
• css
$ sass sass/application.scss css/application.css
Sass
Imports File Structure
• project_awesome
• sass
• lib
• fontawesome.scss
• base.scss
• grid.scss
• application.scss
• css
$ sass sass/application.scss css/application.css
Sass
• application.css
Imports File Structure
• project_awesome
• sass
• lib
• fontawesome.scss
• base.scss
• grid.scss
• application.scss
$ sass sass/ css/
Imports File Structure
• project_awesome
• sass
• lib
• fontawesome.scss
• base.scss
• grid.scss
• application.scss
$ sass sass/ css/
• project_awesome
• css
• lib
• fontawesome.css
• base.css
• grid.css
• application.css
MAGIC
Import Partials
• project_awesome
• sass
• lib
• _fontawesome.scss
• _base.scss
• _grid.scss
• application.scss
• print.css
$ sass sass/ css/
Import Partials
• project_awesome
• sass
• lib
• _fontawesome.scss
• _base.scss
• _grid.scss
• application.scss
• print.css
$ sass sass/ css/
MAGIC
• project_awesome
• sass
• …
• css
• application.css
• print.css
VARIABLES
Variables
WTF is
#531946?
#30162b?
#095179?
WAT?
Variables
Variables let you
reuse single values.
Sass
Variable Uses
colors
font sizes
font families
font paths
padding
margins
breakpoints
border-radius
pseudo content
shadows
gradients
SELECTORS!
LOGIC!
ALL THE THINGS!!!1!
Variable Data Types
Numbers
Strings
Colors
Lists
Booleans
Null
Maps
Sass
Variable Dynamics
• Mutable.
• Can be
interpolated.
• Have scopes.
Sass
MATH+
COLOR
Math
• + addition
• - subtraction
• * multiplication
• / division
• % modulus
Sass gives us basic math operations.
Sass
SassyCSS
Math Functions
• abs($num) - absolute value
• ceil($num) - round up to closest whole number
• floor($num) - round down to closest whole number
• percentage($num) - convert to percentage
• round($num) - round to closest whole number
• max($list) - maximum list value
• min($list) - minimum list value
Sass comes with a set of math functions.
Color Math
We can even use math to manipulate colors.
Sass
Color Functions
• rgba($hex, $alpha)
• lighten($color, $percent)
• darken($color, $percent)
• saturate($color, $percent)
• desaturate($color, $percent)
• mix($color1, $color2)
• grayscale($color)
• invert($color)
• complement($color)
• AND MANY MORE!
Sass comes with AWESOME color functions.
http://sassme.arc90.com
MIXINS
Mixins
Variables let you reuse single values
Mixins let you reuse blocks of styles
Mixins Use
CSS Sass
Mixins output their contents where they are called.
Mixin Output
Mixin Features
• argument defaults
• multiple arguments
• optional arguments
M
AGIC
CSS
Sass
Mixin Alternative?
Grouped OutputCSS
@EXTEND
INHERITANCE
@extend
Lets you group selectors
and styles together
MAGIC
Sass
CSS
Placeholders
Placeholders can be @extended but will
never compile to the CSS on their own
MAGIC
Sass
CSS
Plus Lots More WIN
Functions
Conditions
extra-light
Each Loops
For Loops
While Loops
Maps
Key-value pairs.
• Multiple assignment in loops.
• Lots of helper methods.
Demo Time
https://github.com/roytomeij/sassconf
Getting Sassy with CSS
Resources
Sass-Lang.com
The Sass Way
Sass For Web Designers
Assembling Sass
SassNews Newsletter
SassConf
SassConf 2013 Videos
SassMeister
Sass Style Guide
#teamSass
Closing Tips
• Take it one step at a time.
• Keep an eye on your output.
• Don’t nest too deeply.
• Mind your @mixins and @media queries.
• Careful with your @extends.
• Modularize all the things.
<3
Thank You!
Getting Sassy
with CSS
#SassyCSS
bit.ly/getting-sassy
Questions?

More Related Content

KEY
Advanced sass/compass
KEY
Authoring Stylesheets with Compass & Sass
KEY
Wrangling the CSS Beast with Sass
PDF
PDF
Sass and compass workshop
KEY
Compass/Sass
PDF
Performant, accessible animations with CSS & a dash of JavaScript
PPTX
Doing More With Less
Advanced sass/compass
Authoring Stylesheets with Compass & Sass
Wrangling the CSS Beast with Sass
Sass and compass workshop
Compass/Sass
Performant, accessible animations with CSS & a dash of JavaScript
Doing More With Less

What's hot (20)

PDF
PDF
10 Advanced CSS Techniques (You Wish You Knew More About)
PPTX
Journey To The Front End World - Part2 - The Cosmetic
ZIP
Vector Graphics on the Web: SVG, Canvas, CSS3
PPTX
ECS19 - Chris Kent - List Formatting in Office 365 and SharePoint 2019
PPTX
Web 102 INtro to CSS
PPTX
Sara Soueidan: Styling and Animating Scalable Vector Graphics with CSS [CSSCo...
PDF
Learn svg
PDF
Intro to HTML + CSS
PPTX
CSS Walktrough Internship Course
PDF
CSS3: Ripe and Ready to Respond
PDF
Mobile and Responsive Design with Sass
PPTX
Css 3
PPTX
Css 3
PDF
Getting SASSy with front end development
PPTX
Castro Chapter 7
PPTX
Colors In CSS3
PDF
Sane CSS - A modern approach to CSS
PDF
Intro to html, css & sass
PDF
Cycle circular round jigsaw maze piece puzzle with center 4 powerpoint ppt te...
10 Advanced CSS Techniques (You Wish You Knew More About)
Journey To The Front End World - Part2 - The Cosmetic
Vector Graphics on the Web: SVG, Canvas, CSS3
ECS19 - Chris Kent - List Formatting in Office 365 and SharePoint 2019
Web 102 INtro to CSS
Sara Soueidan: Styling and Animating Scalable Vector Graphics with CSS [CSSCo...
Learn svg
Intro to HTML + CSS
CSS Walktrough Internship Course
CSS3: Ripe and Ready to Respond
Mobile and Responsive Design with Sass
Css 3
Css 3
Getting SASSy with front end development
Castro Chapter 7
Colors In CSS3
Sane CSS - A modern approach to CSS
Intro to html, css & sass
Cycle circular round jigsaw maze piece puzzle with center 4 powerpoint ppt te...
Ad

Viewers also liked (9)

PPTX
So You Think You Know Podcasting
PDF
Lessons learned from The Innovation Hub
PPT
Professor John Higgins
PDF
Thinking Fast and Slow
PPTX
Product Management 90 Day Plan
PPTX
30 60 90 Day Plan Format
PDF
BVU Technology and Communications Summit Plenary Powerpoint
 
PPTX
The Changing Role of IT Staff
 
PPTX
LeadingAST.com - Sample 90 day leadership plan
So You Think You Know Podcasting
Lessons learned from The Innovation Hub
Professor John Higgins
Thinking Fast and Slow
Product Management 90 Day Plan
30 60 90 Day Plan Format
BVU Technology and Communications Summit Plenary Powerpoint
 
The Changing Role of IT Staff
 
LeadingAST.com - Sample 90 day leadership plan
Ad

Similar to Getting Sassy with CSS (20)

PPTX
Sass:-Syntactically Awesome Stylesheet by Shafeeq
PDF
DrupalCamp Chattanooga - September 2014 - Sass 101
PDF
Intro to Sass for WordPress Developers
PDF
Sass that CSS
PPTX
Sass_Cubet seminar
PPTX
The sass way - Yatendra Bhardwaj
PPT
UNIT 3.ppt
PPTX
Bliblidotcom - SASS Introduction
PDF
SASS, Compass, Gulp, Greensock
PDF
European SharePoint Webinar - Make SharePoint Sassy
PDF
CSS 開發加速指南-Sass & Compass
PDF
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
PPTX
PPTX
SASS is more than LESS
PPTX
SCSS Implementation
PDF
SASS Preprocessor
PPTX
Make your CSS beautiful again
PPTX
Simple introduction Sass
PPS
Why are we using Sass to create Grid Frameworks?
Sass:-Syntactically Awesome Stylesheet by Shafeeq
DrupalCamp Chattanooga - September 2014 - Sass 101
Intro to Sass for WordPress Developers
Sass that CSS
Sass_Cubet seminar
The sass way - Yatendra Bhardwaj
UNIT 3.ppt
Bliblidotcom - SASS Introduction
SASS, Compass, Gulp, Greensock
European SharePoint Webinar - Make SharePoint Sassy
CSS 開發加速指南-Sass & Compass
Atlanta Drupal User's Group - April 2015 - Sasstronauts: Advanced Sass Topics
SASS is more than LESS
SCSS Implementation
SASS Preprocessor
Make your CSS beautiful again
Simple introduction Sass
Why are we using Sass to create Grid Frameworks?

More from Julie Cameron (7)

PDF
Growing a Thriving and Engaged Remote Team
PDF
Yoga & mindfulness for people who stare at computers all day
PDF
Lifesaving, Timesaving, Sanity-saving HOTKEYS!
PDF
On Entering Open Source
PDF
Decoupling the Front-end with Modular CSS
PDF
Intro to OOCSS Workshop
PDF
OOCSS Lightening Talk
Growing a Thriving and Engaged Remote Team
Yoga & mindfulness for people who stare at computers all day
Lifesaving, Timesaving, Sanity-saving HOTKEYS!
On Entering Open Source
Decoupling the Front-end with Modular CSS
Intro to OOCSS Workshop
OOCSS Lightening Talk

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Cloud computing and distributed systems.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPT
Teaching material agriculture food technology
PDF
KodekX | Application Modernization Development
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Network Security Unit 5.pdf for BCA BBA.
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Approach and Philosophy of On baking technology
Chapter 3 Spatial Domain Image Processing.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Electronic commerce courselecture one. Pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Cloud computing and distributed systems.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Reach Out and Touch Someone: Haptics and Empathic Computing
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Teaching material agriculture food technology
KodekX | Application Modernization Development
Dropbox Q2 2025 Financial Results & Investor Presentation
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
“AI and Expert System Decision Support & Business Intelligence Systems”
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Programs and apps: productivity, graphics, security and other tools
Network Security Unit 5.pdf for BCA BBA.

Getting Sassy with CSS