15. Sass
• CSS meta-language
• Simpler, more elegant syntax for CSS
• Helps to create manageable stylesheets
16. Sass
• CSS meta-language
• Simpler, more elegant syntax for CSS
• Helps to create manageable stylesheets
• An upgrade to CSS
17. Sass
• CSS meta-language
• Simpler, more elegant syntax for CSS
• Helps to create manageable stylesheets
• An upgrade to CSS
Sass makes CSS fun again.
18. Two delicious flavors
Sass Sass & SCSS
• CSS meta-language
• Simpler, more elegant syntax for CSS
• Helps to create manageable stylesheets
• An upgrade to CSS
Sass makes CSS fun again.
21. • CSS authoring framework built in Sass
• Collection of Sass mixins and functions
22. • CSS authoring framework built in Sass
• Collection of Sass mixins and functions
• Library of the web’s most reusable CSS patterns
23. • CSS authoring framework built in Sass
• Collection of Sass mixins and functions
• Library of the web’s most reusable CSS patterns
• Makes CSS3 easy
30. Two delicous flavors…
Sass and SCSS
• both functionally equivalent
• both support the same feature set
• neither will be deprecated
31. Two delicous flavors…
Sass and SCSS
• both functionally equivalent
• both support the same feature set
• neither will be deprecated
• SCSS is not a successor to Sass
32. Two delicous flavors…
Sass and SCSS
• both functionally equivalent
• both support the same feature set
• neither will be deprecated
• SCSS is not a successor to Sass
• each make different people happy
33. Two delicous flavors…
Sass and SCSS
• both functionally equivalent
• both support the same feature set
• neither will be deprecated
• SCSS is not a successor to Sass
• each make different people happy
• some people like both
34.
35. CSS
nav {
background: #ccc;
width: 500px;
margin: 10px auto;
}
nav a {
float: left;
display: block;
padding: 0 5px;
color: #666;
}
nav a:hover {
color: #000;
}
36. CSS SCSS
nav { nav {
background: #ccc; background: #ccc;
width: 500px; width: 500px;
margin: 10px auto; margin: 10px auto;
} a {
nav a { float: left;
float: left; display: block;
display: block; padding: 0 5px;
padding: 0 5px; color: #666;
color: #666; &:hover {
} color: #000;
nav a:hover { }
color: #000; }
} }
37. CSS SCSS
nav { nav {
background: #ccc; background: #ccc;
width: 500px; width: 500px;
margin: 10px auto; margin: 10px auto;
} a {
nav a { float: left; nesting
float: left; display: block;
display: block; padding: 0 5px;
padding: 0 5px; color: #666;
color: #666; &:hover {
} color: #000;
nav a:hover { }
color: #000; }
} }
38. CSS SCSS
nav { nav {
background: #ccc; background: #ccc;
width: 500px; width: 500px;
margin: 10px auto; margin: 10px auto;
} a {
nav a { float: left; nesting
float: left; display: block;
display: block; padding: 0 5px;
padding: 0 5px; color: #666;
color: #666; &:hover {
} color: #000;
nav a:hover { }
color: #000; }
} }
39. CSS SCSS
nav { nav {
background: #ccc; background: #ccc;
width: 500px; width: 500px;
margin: 10px auto; margin: 10px auto;
} a {
nav a { float: left; nesting
float: left; display: block;
display: block; padding: 0 5px;
padding: 0 5px; color: #666;
color: #666; &:hover {
} color: #000;
nav a:hover { }
color: #000; }
} }
40. CSS SCSS
nav { nav {
background: #ccc; background: #ccc;
width: 500px; width: 500px;
margin: 10px auto; margin: 10px auto;
} a {
nav a { float: left; nesting
float: left; display: block;
display: block; padding: 0 5px;
padding: 0 5px; color: #666;
color: #666; &:hover {
} color: #000;
nav a:hover { }
color: #000; }
} }
the parent selector
41. CSS SCSS
nav { nav {
background: #ccc; background: #ccc;
width: 500px; width: 500px;
margin: 10px auto; margin: 10px auto;
} a {
nav a { float: left; nesting
float: left; display: block;
display: block; padding: 0 5px;
padding: 0 5px; color: #666;
color: #666; &:hover {
} color: #000;
nav a:hover { }
color: #000; }
} }
the parent selector
42. CSS SCSS
nav { nav {
background: #ccc; background: #ccc;
width: 500px; width: 500px;
margin: 10px auto; margin: 10px auto;
} a {
nav a { float: left;
float: left; display: block;
display: block; padding: 0 5px;
padding: 0 5px; color: #666;
color: #666; &:hover {
} color: #000;
nav a:hover { }
color: #000; }
} }
43. CSS SCSS
nav { nav {
background: #ccc; background: #ccc;
width: 500px; width: 500px;
margin: 10px auto; margin: 10px auto;
} a {
nav a { float: left;
float: left; display: block;
display: block; padding: 0 5px;
padding: 0 5px; color: #666;
color: #666; &:hover {
} color: #000;
nav a:hover { }
color: #000; }
} }
SCSS doesn’t care about whitespace
nav { width: 500px; margin: 10px auto;
background: #ccc;
a { float: left; display: block; padding: 0 5px;
color: #666;
&:hover { color: #000; }}}
44. CSS SCSS
nav { nav {
background: #ccc; background: #ccc;
width: 500px; width: 500px;
margin: 10px auto; margin: 10px auto;
} a {
nav a { float: left;
float: left; display: block;
display: block; padding: 0 5px;
padding: 0 5px; color: #666;
color: #666; &:hover {
} color: #000;
nav a:hover { }
color: #000; }
} }
45. CSS SCSS Sass
nav { nav { nav
background: #ccc; background: #ccc; background: #ccc
width: 500px; width: 500px; width: 500px
margin: 10px auto; margin: 10px auto; margin: 10px auto
} a { a
nav a { float: left; float: left
float: left; display: block; display: block
display: block; padding: 0 5px; padding: 0 5px
padding: 0 5px; color: #666; color: #666
color: #666; &:hover { &:hover
} color: #000; color: #000
nav a:hover { }
color: #000; }
} }
46. CSS SCSS Sass
nav { nav { nav
background: #ccc; background: #ccc; background: #ccc
width: 500px; width: 500px; width: 500px
margin: 10px auto; margin: 10px auto; margin: 10px auto
} a { a
nav a { float: left; float: left
float: left; display: block; display: block
display: block; padding: 0 5px; padding: 0 5px
padding: 0 5px; color: #666; color: #666
color: #666; &:hover { &:hover
} color: #000; color: #000
nav a:hover { }
color: #000; }
} }
47. CSS SCSS Sass
nav { nav { nav
background: #ccc; background: #ccc; background: #ccc
width: 500px; width: 500px; width: 500px
margin: 10px auto; margin: 10px auto; margin: 10px auto
} a { a
nav a { float: left; float: left
float: left; display: block; display: block
display: block; padding: 0 5px; padding: 0 5px
padding: 0 5px; color: #666; color: #666
color: #666; &:hover { &:hover
} color: #000; color: #000
nav a:hover { }
color: #000; }
} }
48. CSS SCSS Sass
nav { nav { nav
background: #ccc; background: #ccc; background: #ccc
width: 500px; width: 500px; width: 500px
margin: 10px auto; margin: 10px auto; margin: 10px auto
} a { a
nav a { float: left; float: left
float: left; display: block; display: block
display: block; padding: 0 5px; padding: 0 5px
padding: 0 5px; color: #666; color: #666
color: #666; &:hover { &:hover
} color: #000; color: #000
nav a:hover { }
color: #000; }
} }
54. Advantages of each…
SCSS Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
55. Advantages of each…
SCSS Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
56. Advantages of each…
SCSS Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
57. Advantages of each…
SCSS Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
58. Advantages of each…
SCSS Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
59. Advantages of each…
SCSS Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
60. Advantages of each…
SCSS Sass
• the “newer” syntax
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
61. Advantages of each…
SCSS Sass
• the “newer” syntax • no curly braces or semicolons
• a super set of CSS
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
62. Advantages of each…
SCSS Sass
• the “newer” syntax • no curly braces or semicolons
• a super set of CSS • white-space aware
• very similar to CSS
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
63. Advantages of each…
SCSS Sass
• the “newer” syntax • no curly braces or semicolons
• a super set of CSS • white-space aware
• very similar to CSS • shortcuts for @mixin and @include
• low barrier to entry
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
64. Advantages of each…
SCSS Sass
• the “newer” syntax • no curly braces or semicolons
• a super set of CSS • white-space aware
• very similar to CSS • shortcuts for @mixin and @include
• low barrier to entry • more scannable
• allows for single-line rules
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
65. Advantages of each…
SCSS Sass
• the “newer” syntax • no curly braces or semicolons
• a super set of CSS • white-space aware
• very similar to CSS • shortcuts for @mixin and @include
• low barrier to entry • more scannable
• allows for single-line rules • more concise, better for teams
• more flexible for expression
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
66. Advantages of each…
SCSS Sass
• the “newer” syntax • no curly braces or semicolons
• a super set of CSS • white-space aware
• very similar to CSS • shortcuts for @mixin and @include
• low barrier to entry • more scannable
• allows for single-line rules • more concise, better for teams
• more flexible for expression • enforces one declaration per line
• compatible with many CSS parsers
• easy to integrate with existing CSS
• DRY
• the “original” syntax
67. Advantages of each…
SCSS Sass
• the “newer” syntax • no curly braces or semicolons
• a super set of CSS • white-space aware
• very similar to CSS • shortcuts for @mixin and @include
• low barrier to entry • more scannable
• allows for single-line rules • more concise, better for teams
• more flexible for expression • enforces one declaration per line
• compatible with many CSS parsers • cleaner merges
• easy to integrate with existing CSS
• DRY
• the “original” syntax
68. Advantages of each…
SCSS Sass
• the “newer” syntax • no curly braces or semicolons
• a super set of CSS • white-space aware
• very similar to CSS • shortcuts for @mixin and @include
• low barrier to entry • more scannable
• allows for single-line rules • more concise, better for teams
• more flexible for expression • enforces one declaration per line
• compatible with many CSS parsers • cleaner merges
• easy to integrate with existing CSS • DRY, arguably more so.
• DRY
• the “original” syntax
69. Advantages of each…
SCSS Sass
• the “newer” syntax • no curly braces or semicolons
• a super set of CSS • white-space aware
• very similar to CSS • shortcuts for @mixin and @include
• low barrier to entry • more scannable
• allows for single-line rules • more concise, better for teams
• more flexible for expression • enforces one declaration per line
• compatible with many CSS parsers • cleaner merges
• easy to integrate with existing CSS • DRY, arguably more so.
• DRY
• the “original” syntax
Try both …you may want to use both.
77. Our content…
<div class="flash-info">
<img src="images/icon-info.png" alt="info icon" class="flash-icon">
<p>You have mail.</p>
</div>
<div class="flash-success">
<img src="images/icon-success.png" alt="success icon" class="flash-icon">
<p>Settings updated!</p>
</div>
<div class="flash-error">
<img src="images/icon-error.png" alt="error icon" class="flash-icon">
<p>Please fix the following errors:</p>
<ul>
<li>Username requires more pazazz.</li>
<li>Password is too easy to hack.</li>
<li>You must be at least this tall to ride this ride.</li>
</ul>
</div>
78. Our content…
<div class="flash-info">
<img src="images/icon-info.png" alt="info icon" class="flash-icon"> info
<p>You have mail.</p>
</div>
<div class="flash-success">
<img src="images/icon-success.png" alt="success icon" class="flash-icon">
<p>Settings updated!</p>
</div>
<div class="flash-error">
<img src="images/icon-error.png" alt="error icon" class="flash-icon">
<p>Please fix the following errors:</p>
<ul>
<li>Username requires more pazazz.</li>
<li>Password is too easy to hack.</li>
<li>You must be at least this tall to ride this ride.</li>
</ul>
</div>
79. Our content…
<div class="flash-info">
<img src="images/icon-info.png" alt="info icon" class="flash-icon">
<p>You have mail.</p>
</div>
<div class="flash-success">
<img src="images/icon-success.png" alt="success icon" class="flash-icon">
<p>Settings updated!</p> success
</div>
<div class="flash-error">
<img src="images/icon-error.png" alt="error icon" class="flash-icon">
<p>Please fix the following errors:</p>
<ul>
<li>Username requires more pazazz.</li>
<li>Password is too easy to hack.</li>
<li>You must be at least this tall to ride this ride.</li>
</ul>
</div>
80. Our content…
<div class="flash-info">
<img src="images/icon-info.png" alt="info icon" class="flash-icon">
<p>You have mail.</p>
</div>
<div class="flash-success">
<img src="images/icon-success.png" alt="success icon" class="flash-icon">
<p>Settings updated!</p>
</div>
<div class="flash-error">
<img src="images/icon-error.png" alt="error icon" class="flash-icon">
<p>Please fix the following errors:</p>
<ul>
<li>Username requires more pazazz.</li>
error
<li>Password is too easy to hack.</li>
<li>You must be at least this tall to ride this ride.</li>
</ul>
</div>
81. messaging.css
body {
background: #e3e3e3;
margin: 20px;
font: 16px/24px sans-serif;
}
ul {
list-style: disc;
margin-left: 20px;
}
82. messaging.css
body {
background: #e3e3e3;
margin: 20px; layout
font: 16px/24px sans-serif;
}
ul {
list-style: disc;
margin-left: 20px;
}
83. messaging.css
body {
background: #e3e3e3;
margin: 20px;
font: 16px/24px sans-serif;
}
ul {
list-style: disc;
margin-left: 20px; prose
}
117. @import (in Sass)
• not during page render in browser like in CSS
• when compiling Sass to CSS
118. @import (in Sass)
• not during page render in browser like in CSS
• when compiling Sass to CSS
• organize your styles into logical partials
119. @import (in Sass)
• not during page render in browser like in CSS
• when compiling Sass to CSS
• organize your styles into logical partials
• combine many files into one
120. @import (in Sass)
• not during page render in browser like in CSS
• when compiling Sass to CSS
• organize your styles into logical partials
• combine many files into one
• serve fewer css files per request
182. $variables
• containers for values
• variable name define the purpose of values
• Five value types in Sass:
183. $variables
• containers for values
• variable name define the purpose of values
• Five value types in Sass:
• numbers: 5, 8.2, 99%, 20px
184. $variables
• containers for values
• variable name define the purpose of values
• Five value types in Sass:
• numbers: 5, 8.2, 99%, 20px
• text strings: foo bar, “baz qux”
185. $variables
• containers for values
• variable name define the purpose of values
• Five value types in Sass:
• numbers: 5, 8.2, 99%, 20px
• text strings: foo bar, “baz qux”
• colors: #38e1b2, rgba(0, 128, 255, 0.3)
186. $variables
• containers for values
• variable name define the purpose of values
• Five value types in Sass:
• numbers: 5, 8.2, 99%, 20px
• text strings: foo bar, “baz qux”
• colors: #38e1b2, rgba(0, 128, 255, 0.3)
• booleans: true or false
187. $variables
• containers for values
• variable name define the purpose of values
• Five value types in Sass:
• numbers: 5, 8.2, 99%, 20px
• text strings: foo bar, “baz qux”
• colors: #38e1b2, rgba(0, 128, 255, 0.3)
• booleans: true or false
• lists: 2px 10px 15px or Arial, Helvetica, Courier
202. Math
Just like in algebra class, show your work.
• Replace arbitrary numbers with calculations.
203. Math
Just like in algebra class, show your work.
• Replace arbitrary numbers with calculations.
• Control your grid styles
204. Math
Just like in algebra class, show your work.
• Replace arbitrary numbers with calculations.
• Control your grid styles
• Document logic in your styles