Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Sass Why for the CSS Guy

Beau Smith
April 06, 2012

Sass Why for the CSS Guy

An intro to Sass and Compass for CSS fans. From @Beau Smith, front end tech lead at @Square.

Previously posted to: http://www.slideshare.net/beausmith/sass-why-for-the-css-guy-9475297

Beau Smith

April 06, 2012
Tweet

More Decks by Beau Smith

Other Decks in Design

Transcript

  1. • CSS meta-language • Simpler, more elegant syntax for CSS

    • Helps to create manageable stylesheets Sass
  2. • CSS meta-language • Simpler, more elegant syntax for CSS

    • Helps to create manageable stylesheets • An upgrade to CSS Sass
  3. • CSS meta-language • Simpler, more elegant syntax for CSS

    • Helps to create manageable stylesheets • An upgrade to CSS Sass makes CSS fun again. Sass
  4. • CSS meta-language • Simpler, more elegant syntax for CSS

    • Helps to create manageable stylesheets • An upgrade to CSS Sass makes CSS fun again. Sass Two delicious flavors Sass & SCSS
  5. • CSS authoring framework built in Sass • Collection of

    Sass mixins and functions • Library of the web’s most reusable CSS patterns
  6. • CSS authoring framework built in Sass • Collection of

    Sass mixins and functions • Library of the web’s most reusable CSS patterns • Makes CSS3 easy
  7. • both functionally equivalent • both support the same feature

    set Sass and SCSS Two delicous flavors…
  8. • both functionally equivalent • both support the same feature

    set • neither will be deprecated Sass and SCSS Two delicous flavors…
  9. • both functionally equivalent • both support the same feature

    set • neither will be deprecated • SCSS is not a successor to Sass Sass and SCSS Two delicous flavors…
  10. • 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 Sass and SCSS Two delicous flavors…
  11. • 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 Sass and SCSS Two delicous flavors…
  12. CSS nav { background: #ccc; width: 500px; margin: 10px auto;

    } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  13. CSS SCSS nav { background: #ccc; width: 500px; margin: 10px

    auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  14. CSS SCSS nesting nav { background: #ccc; width: 500px; margin:

    10px auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  15. CSS SCSS nesting nav { background: #ccc; width: 500px; margin:

    10px auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  16. CSS SCSS nesting nav { background: #ccc; width: 500px; margin:

    10px auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  17. CSS SCSS the parent selector nesting nav { background: #ccc;

    width: 500px; margin: 10px auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  18. CSS SCSS the parent selector nesting nav { background: #ccc;

    width: 500px; margin: 10px auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  19. CSS SCSS nav { background: #ccc; width: 500px; margin: 10px

    auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  20. CSS nav { width: 500px; margin: 10px auto; background: #ccc;

    a { float: left; display: block; padding: 0 5px; color: #666; &:hover { color: #000; }}} SCSS SCSS doesn’t care about whitespace nav { background: #ccc; width: 500px; margin: 10px auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  21. CSS SCSS nav { background: #ccc; width: 500px; margin: 10px

    auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  22. CSS SCSS Sass nav background: #ccc width: 500px margin: 10px

    auto a float: left padding: 0 5px color: #666 &:hover color: #000 nav { background: #ccc; width: 500px; margin: 10px auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  23. CSS SCSS Sass nav background: #ccc width: 500px margin: 10px

    auto a float: left padding: 0 5px color: #666 &:hover color: #000 nav { background: #ccc; width: 500px; margin: 10px auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; } whitespace is important
  24. CSS SCSS Sass nav background: #ccc width: 500px margin: 10px

    auto a float: left padding: 0 5px color: #666 &:hover color: #000 nav { background: #ccc; width: 500px; margin: 10px auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  25. CSS SCSS Sass nav background: #ccc width: 500px margin: 10px

    auto a float: left padding: 0 5px color: #666 &:hover color: #000 nav { background: #ccc; width: 500px; margin: 10px auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  26. CSS SCSS Sass nav background: #ccc width: 500px margin: 10px

    auto a float: left padding: 0 5px color: #666 &:hover color: #000 nav { background: #ccc; width: 500px; margin: 10px auto; a { float: left; padding: 0 5px; color: #666; &:hover { color: #000; } } } nav { background: #ccc; width: 500px; margin: 10px auto; } nav a { float: left; padding: 0 5px; color: #666; } nav a:hover { color: #000; }
  27. • the “newer” syntax • a super set of CSS

    SCSS Sass Advantages of each…
  28. • the “newer” syntax • a super set of CSS

    • very similar to CSS SCSS Sass Advantages of each…
  29. • the “newer” syntax • a super set of CSS

    • very similar to CSS • low barrier to entry SCSS Sass Advantages of each…
  30. • the “newer” syntax • a super set of CSS

    • very similar to CSS • low barrier to entry • allows for single-line rules SCSS Sass Advantages of each…
  31. • 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 SCSS Sass Advantages of each…
  32. • 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 SCSS Sass Advantages of each…
  33. • 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 SCSS Sass Advantages of each…
  34. • 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 SCSS Sass Advantages of each…
  35. • 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 SCSS Sass Advantages of each…
  36. • 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 • no curly braces or semicolons SCSS Sass Advantages of each…
  37. • 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 • no curly braces or semicolons • white-space aware SCSS Sass Advantages of each…
  38. • 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 • no curly braces or semicolons • white-space aware • shortcuts for @mixin and @include SCSS Sass Advantages of each…
  39. • 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 • no curly braces or semicolons • white-space aware • shortcuts for @mixin and @include • more scannable SCSS Sass Advantages of each…
  40. • 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 • no curly braces or semicolons • white-space aware • shortcuts for @mixin and @include • more scannable • more concise, better for teams SCSS Sass Advantages of each…
  41. • 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 • no curly braces or semicolons • white-space aware • shortcuts for @mixin and @include • more scannable • more concise, better for teams • enforces one declaration per line SCSS Sass Advantages of each…
  42. • 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 • no curly braces or semicolons • white-space aware • shortcuts for @mixin and @include • more scannable • more concise, better for teams • enforces one declaration per line • cleaner merges SCSS Sass Advantages of each…
  43. • 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 • no curly braces or semicolons • white-space aware • shortcuts for @mixin and @include • more scannable • more concise, better for teams • enforces one declaration per line • cleaner merges • DRY, arguably more so SCSS Sass Advantages of each…
  44. • 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 • no curly braces or semicolons • white-space aware • shortcuts for @mixin and @include • more scannable • more concise, better for teams • enforces one declaration per line • cleaner merges • DRY, arguably more so SCSS Sass Try both …you may want to use both. Advantages of each…
  45. • Add Compass to a project • @import & partials

    • @extend • nesting • $variables • @mixin • sprites • inline images • CSS3 Today’s Roadmap
  46. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="reset.css"

    rel="stylesheet" /> <link href="messaging.css" rel="stylesheet" /> </head> <body> <!-- content here --> </body> </html> messaging.html
  47. <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> Our content…
  48. <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> Our content… info
  49. <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> Our content… success
  50. <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> Our content… error
  51. body { background: #e3e3e3; margin: 20px; font: 16px/24px sans-serif; }

    ul { list-style: disc; margin-left: 20px; } messaging.css
  52. body { background: #e3e3e3; margin: 20px; font: 16px/24px sans-serif; }

    ul { list-style: disc; margin-left: 20px; } messaging.css layout
  53. body { background: #e3e3e3; margin: 20px; font: 16px/24px sans-serif; }

    ul { list-style: disc; margin-left: 20px; } messaging.css prose
  54. .flash-info { position: relative; margin: 0 auto 15px; width: 435px;

    background: #a4a4a4; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #838484; } .flash-success { position: relative; margin: 0 auto 15px; width: 435px; background: #1b942a; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #1a7e1c; } .flash-error { position: relative; margin: 0 auto 15px; width: 435px; background: #ef9000; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; } messaging.css
  55. .flash-info { position: relative; margin: 0 auto 15px; width: 435px;

    background: #a4a4a4; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #838484; } .flash-success { position: relative; margin: 0 auto 15px; width: 435px; background: #1b942a; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #1a7e1c; } .flash-error { position: relative; margin: 0 auto 15px; width: 435px; background: #ef9000; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; } messaging.css info
  56. .flash-info { position: relative; margin: 0 auto 15px; width: 435px;

    background: #a4a4a4; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #838484; } .flash-success { position: relative; margin: 0 auto 15px; width: 435px; background: #1b942a; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #1a7e1c; } .flash-error { position: relative; margin: 0 auto 15px; width: 435px; background: #ef9000; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; } messaging.css success
  57. .flash-info { position: relative; margin: 0 auto 15px; width: 435px;

    background: #a4a4a4; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #838484; } .flash-success { position: relative; margin: 0 auto 15px; width: 435px; background: #1b942a; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #1a7e1c; } .flash-error { position: relative; margin: 0 auto 15px; width: 435px; background: #ef9000; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; } messaging.css error
  58. .flash-info { position: relative; margin: 0 auto 15px; width: 435px;

    background: #a4a4a4; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #838484; } .flash-success { position: relative; margin: 0 auto 15px; width: 435px; background: #1b942a; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #1a7e1c; } .flash-error { position: relative; margin: 0 auto 15px; width: 435px; background: #ef9000; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; } messaging.css error items
  59. .flash-info { position: relative; margin: 0 auto 15px; width: 435px;

    background: #a4a4a4; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #838484; } .flash-success { position: relative; margin: 0 auto 15px; width: 435px; background: #1b942a; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #1a7e1c; } .flash-error { position: relative; margin: 0 auto 15px; width: 435px; background: #ef9000; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; } messaging.css icon
  60. Add Compass to project ~ ~/sass-why ~/sass-why cd sass-why compass

    create compass compile create stylesheets/messaging.css create stylesheets/reset.css ~/sass-why
  61. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="reset.css"

    rel="stylesheet" /> <link href="messaging.css" rel="stylesheet" /> </head> <body> <div class="flash-info"> ••• <div class="flash-success"> ••• <div class="flash-error"> ••• </body> </html> messaging.html
  62. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="reset.css"

    rel="stylesheet" /> <link href="messaging.css" rel="stylesheet" /> </head> <body> <div class="flash-info"> ••• <div class="flash-success"> ••• <div class="flash-error"> ••• </body> </html> messaging.html update links
  63. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="stylesheets/reset.css"

    rel="stylesheet" /> <link href="stylesheets/messaging.css" rel="stylesheet" /> </head> <body> <div class="flash-info"> ••• <div class="flash-success"> ••• <div class="flash-error"> ••• </body> </html> messaging.html update links
  64. • not during page render in browser like in CSS

    • when compiling Sass to CSS @import (in Sass)
  65. • not during page render in browser like in CSS

    • when compiling Sass to CSS • organize your styles into logical partials @import (in Sass)
  66. • 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 @import (in Sass)
  67. • 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 @import (in Sass)
  68. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="stylesheets/reset.css"

    rel="stylesheet" /> <link href="stylesheets/messaging.css" rel="stylesheet" /> </head> <body> <div class="flash-info"> ••• <div class="flash-success"> ••• <div class="flash-error"> ••• </body> </html> messaging.html
  69. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="stylesheets/reset.css"

    rel="stylesheet" /> <link href="stylesheets/messaging.css" rel="stylesheet" /> </head> <body> <div class="flash-info"> ••• <div class="flash-success"> ••• <div class="flash-error"> ••• </body> </html> messaging.html remove these
  70. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Sass Why</title> <link href="stylesheets/screen.css"

    rel="stylesheet" /> </head> <body> <div class="flash-info"> ••• <div class="flash-success"> ••• <div class="flash-error"> ••• </body> </html> messaging.html add screen.css
  71. body { background: #e3e3e3; margin: 20px; font: 16px/24px sans-serif; }

    ul { list-style: disc; margin-left: 20px; } _layout.scss layout prose
  72. _messaging.scss .flash-info { position: relative; margin: 0 auto 15px; width:

    435px; background: #a4a4a4; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #838484; } .flash-success { position: relative; margin: 0 auto 15px; width: 435px; background: #1b942a; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #1a7e1c; } .flash-error { position: relative; margin: 0 auto 15px; width: 435px; background: #ef9000; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  73. _messaging.scss .flash-info { position: relative; margin: 0 auto 15px; width:

    435px; background: #a4a4a4; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #838484; } .flash-success { position: relative; margin: 0 auto 15px; width: 435px; background: #1b942a; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #1a7e1c; } .flash-error { position: relative; margin: 0 auto 15px; width: 435px; background: #ef9000; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  74. _messaging.scss .flash-info { position: relative; margin: 0 auto 15px; width:

    435px; background: #a4a4a4; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #838484; } .flash-success { position: relative; margin: 0 auto 15px; width: 435px; background: #1b942a; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #1a7e1c; } .flash-error { position: relative; margin: 0 auto 15px; width: 435px; background: #ef9000; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; } unique style declarations
  75. _messaging.scss .flash-info, .flash-success, .flash-error { position: relative; margin: 0 auto

    15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  76. _messaging.scss .flash-info, .flash-success, .flash-error { position: relative; margin: 0 auto

    15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  77. _messaging.scss .flash-message { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  78. _messaging.scss .flash-message { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  79. _messaging.scss .flash-message { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { @extend .flash-message; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-message; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  80. _messaging.scss .flash-message { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { @extend .flash-message; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-message; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  81. .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0 auto

    15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; } Compiled CSS
  82. _messaging.scss .flash-info { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-info; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-info; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  83. _messaging.scss .flash-info { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-info; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-info; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  84. _messaging.scss .flash-info { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-info; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-info; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  85. _messaging.scss .flash-info { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-info; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-info; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  86. _messaging.scss .flash-info { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-info; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-info; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  87. .flash-info, .flash-success, .flash-error { position: relative; margin: 0 auto 15px;

    width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; } Compiled CSS
  88. • group styles together • avoid duplication of selectors •

    keep your code DRY Sass nesting ≠ html structure Nesting
  89. • group styles together • avoid duplication of selectors •

    keep your code DRY Sass nesting ≠ html structure Nesting FASTER TRAFFIC KEEP LEFT
  90. Warning about Nesting .subset-section background-color: #FFF width: 960px .subset-skus width:

    790px .subset-selection float: left width: 790px .registrant-needs margin-bottom: 10px text-align: right .subset-attributes width: 430px float: left .subset-pricing display: block text-align: right .price-special font-size: 11px .currency font-size: 16px
  91. Warning about Nesting .subset-section { background-color: white; width: 960px; }

    .subset-section .subset-skus { width: 790px; } .subset-section .subset-skus .subset-selection { float: left; width: 790px; } .subset-section .subset-skus .subset-selection .registrant-needs { margin-bottom: 10px; text-align: right; } .subset-section .subset-skus .subset-selection .registrant-needs .subset-attributes { width: 430px; float: left; } .subset-section .subset-skus .subset-selection .registrant-needs .subset-attributes .subset-pricing display: block; text-align: right; } .subset-section .subset-skus .subset-selection .registrant-needs .subset-attributes .subset-prici font-size: 11px; } .subset-section .subset-skus .subset-selection .registrant-needs .subset-attributes .subset-prici font-size: 16px; }
  92. _messaging.scss .flash-message { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { @extend .flash-message; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-message; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  93. _messaging.scss .flash-message { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { @extend .flash-message; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-message; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  94. _messaging.scss .flash-message { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { @extend .flash-message; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-message; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; .flash-error li { font-weight: normal; } } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  95. _messaging.scss .flash-message { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { @extend .flash-message; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-message; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; .flash-error li { font-weight: normal; } } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  96. _messaging.scss .flash-message { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { @extend .flash-message; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-message; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; li { font-weight: normal; } } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  97. screen.css .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0

    auto 15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  98. screen.css .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0

    auto 15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } output_style = :nested .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  99. screen.css .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0

    auto 15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } output_style = :nested .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  100. screen.css .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0

    auto 15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } output_style = :nested .flash-icon { display: block; position: absolute; top: 11px; right: 12px; } output_style
  101. screen.css .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0

    auto 15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } output_style = :expanded .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  102. screen.css .flash-message, .flash-info, .flash-success, .flash-error { position: relative; margin: 0

    auto 15px; width: 435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { background: #ef9000; text-shadow: 0 -1px #e8541c; } .flash-error li { font-weight: normal; } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; } output_style = :compact
  103. screen.css .flash-message,.flash-info,.flash-success,.flash-error{position:relative;margin:0 auto 15px;width: 435px;border-radius:5px;padding:10px 50px 10px 15px;color:white;font-weight:bold}.flash- info{background:#a4a4a4;text-shadow:0 -1px

    #838484}.flash-success{background:#1b942a;text-shadow:0 -1px #1a7e1c}.flash-error{background:#ef9000;text-shadow:0 -1px #e8541c}.flash-error li{font- weight:normal}.flash-icon{display:block;position:absolute;top:11px;right:12px} output_style = :compressed
  104. _messaging.scss .flash-message { position: relative; margin: 0 auto 15px; width:

    435px; border-radius: 5px; padding: 10px 50px 10px 15px; color: white; font-weight: bold; } .flash-info { @extend .flash-message; background: #a4a4a4; text-shadow: 0 -1px #838484; } .flash-success { @extend .flash-message; background: #1b942a; text-shadow: 0 -1px #1a7e1c; } .flash-error { @extend .flash-message; background: #ef9000; text-shadow: 0 -1px #e8541c; li { font-weight: normal; } } .flash-icon { display: block; position: absolute; top: 11px; right: 12px; }
  105. _messaging.sass .flash-message position: relative margin: 0 auto 15px; width: 435px;

    border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold .flash-info @extend .flash-message background: #a4a4a4 text-shadow: 0 -1px #838484 .flash-success @extend .flash-message background: #1b942a text-shadow: 0 -1px #1a7e1c .flash-error @extend .flash-message background: #ef9000 text-shadow: 0 -1px #e8541c li font-weight: normal .flash-icon display: block position: absolute top: 11px right: 12px
  106. _messaging.sass .flash-message position: relative margin: 0 auto 15px; width: 435px;

    border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold .flash-info @extend .flash-message background: #a4a4a4 text-shadow: 0 -1px #838484 .flash-success @extend .flash-message background: #1b942a text-shadow: 0 -1px #1a7e1c .flash-error @extend .flash-message background: #ef9000 text-shadow: 0 -1px #e8541c li font-weight: normal .flash-icon display: block position: absolute top: 11px right: 12px
  107. • containers for values • variable name define the purpose

    of values • Five value types in Sass: $variables
  108. • containers for values • variable name define the purpose

    of values • Five value types in Sass: • numbers: 5, 8.2, 99%, 20px $variables
  109. • 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” $variables
  110. • 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) $variables
  111. • 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 $variables
  112. • 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 $variables
  113. _messaging.sass .flash-message position: relative margin: 0 auto 15px width: 435px

    border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold .flash-info @extend .flash-message background: #a4a4a4 text-shadow: 0 -1px #838484 .flash-success @extend .flash-message background: #1b942a text-shadow: 0 -1px #1a7e1c .flash-error @extend .flash-message background: #ef9000 text-shadow: 0 -1px #e8541c li font-weight: normal .flash-icon display: block position: absolute top: 11px right: 12px
  114. _messaging.sass .flash-message position: relative margin: 0 auto 15px width: 435px

    border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold .flash-icon display: block position: absolute top: 11px right: 12px .flash-info @extend .flash-message background: #a4a4a4 text-shadow: 0 -1px #838484 .flash-success @extend .flash-message background: #1b942a text-shadow: 0 -1px #1a7e1c .flash-error @extend .flash-message background: #ef9000 text-shadow: 0 -1px #e8541c li font-weight: normal
  115. _messaging.sass .flash-message position: relative margin: 0 auto 15px width: 435px

    border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold .flash-icon display: block position: absolute top: 11px right: 12px .flash-info @extend .flash-message background: #a4a4a4 text-shadow: 0 -1px #838484 .flash-success @extend .flash-message background: #1b942a text-shadow: 0 -1px #1a7e1c .flash-error @extend .flash-message background: #ef9000 text-shadow: 0 -1px #e8541c li font-weight: normal
  116. _messaging.sass $flash-info-background: #a4a4a4 $flash-info-text-shadow: #838484 $flash-success-background: #1b942a $flash-success-text-shadow: #1a7e1c $flash-error-background:

    #ef9000 $flash-error-text-shadow: #e8541c .flash-message position: relative margin: 0 auto 15px width: 435px border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold .flash-icon display: block position: absolute top: 11px right: 12px .flash-info @extend .flash-message background: #a4a4a4 text-shadow: 0 -1px #838484 .flash-success @extend .flash-message background: #1b942a text-shadow: 0 -1px #1a7e1c .flash-error @extend .flash-message background: #ef9000 text-shadow: 0 -1px #e8541c li font-weight: normal
  117. _messaging.sass $flash-info-background: #a4a4a4 $flash-info-text-shadow: #838484 $flash-success-background: #1b942a $flash-success-text-shadow: #1a7e1c $flash-error-background:

    #ef9000 $flash-error-text-shadow: #e8541c .flash-message position: relative margin: 0 auto 15px width: 435px border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold .flash-icon display: block position: absolute top: 11px right: 12px .flash-info @extend .flash-message background: $flash-info-background text-shadow: 0 -1px $flash-info-text-shadow .flash-success @extend .flash-message background: $flash-success-background text-shadow: 0 -1px $flash-success-text-shadow .flash-error @extend .flash-message background: $flash-error-background text-shadow: 0 -1px $flash-error-text-shadow li font-weight: normal
  118. _messaging.sass $flash-info-background: #a4a4a4 $flash-info-text-shadow: #838484 $flash-success-background: #1b942a $flash-success-text-shadow: #1a7e1c $flash-error-background:

    #ef9000 $flash-error-text-shadow: #e8541c .flash-message position: relative margin: 0 auto 15px width: 435px border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold .flash-icon display: block position: absolute top: 11px right: 12px .flash-info @extend .flash-message background: $flash-info-background text-shadow: 0 -1px $flash-info-text-shadow .flash-success @extend .flash-message background: $flash-success-background text-shadow: 0 -1px $flash-success-text-shadow .flash-error @extend .flash-message background: $flash-error-background text-shadow: 0 -1px $flash-error-text-shadow li font-weight: normal
  119. _messaging.sass .flash-message position: relative margin: 0 auto 15px width: 435px

    border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold .flash-icon display: block position: absolute top: 11px right: 12px .flash-info @extend .flash-message background: $flash-info-background text-shadow: 0 -1px $flash-info-text-shadow .flash-success @extend .flash-message background: $flash-success-background text-shadow: 0 -1px $flash-success-text-shadow .flash-error @extend .flash-message background: $flash-error-background text-shadow: 0 -1px $flash-error-text-shadow li font-weight: normal
  120. _config.sass $flash-info-background: #a4a4a4 $flash-info-text-shadow: #838484 $flash-success-background: #1b942a $flash-success-text-shadow: #1a7e1c $flash-error-background:

    #ef9000 $flash-error-text-shadow: #e8541c screen.sass @import compass/reset @import layout @import messaging @import config
  121. Just like in algebra class, show your work. • Replace

    arbitrary numbers with calculations. Math
  122. Just like in algebra class, show your work. • Replace

    arbitrary numbers with calculations. • Control your grid styles Math
  123. Just like in algebra class, show your work. • Replace

    arbitrary numbers with calculations. • Control your grid styles • Document logic in your styles Math
  124. _messaging.sass .flash-message position: relative margin: 0 auto 15px width: 435px

    border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  125. _messaging.sass .flash-message position: relative margin: 0 auto 15px width: 435px

    border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  126. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px .flash-message position: relative width: 435px

    border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  127. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px $flash-message-icon-padding: image-width("icon-info.png") + 15px .flash-message

    position: relative width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  128. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px $flash-message-icon-padding: image-width("icon-info.png") + 15px .flash-message

    position: relative width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  129. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px $flash-message-icon-padding: image-width("icon-info.png") + 15px .flash-message

    position: relative width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  130. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px $flash-message-icon-padding: image-width("icon-info.png") + 15px .flash-message

    position: relative width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  131. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px $flash-message-icon-padding: image-width("icon-info.png") + 15px .flash-message

    position: relative width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding border-radius: 5px padding: 10px 50px 10px 15px color: white font-weight: bold
  132. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px $flash-message-icon-padding: image-width("icon-info.png") + 15px .flash-message

    position: relative width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding border-radius: 5px padding: 10px $flash-message-h-padding + $flash-message-icon-padding 10px $flash-message-h-padding color: white font-weight: bold
  133. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px $flash-message-icon-padding: image-width("icon-info.png") + 15px .flash-message

    position: relative width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding border-radius: 5px padding: 10px $flash-message-h-padding + $flash-message-icon-padding 10px $flash-message-h-padding color: white font-weight: bold
  134. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px $flash-message-icon-padding: image-width("icon-info.png") + 15px .flash-message

    position: relative width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding border-radius: 5px padding: 10px $flash-message-h-padding + $flash-message-icon-padding 10px $flash-message-h-padding color: white font-weight: bold
  135. _messaging.sass $flash-message-width: 500px $flash-message-h-padding: 15px $flash-message-icon-padding: image-width("icon-info.png") + 15px .flash-message

    position: relative width: $flash-message-width - $flash-message-h-padding * 2 - $flash-message-icon-padding border-radius: 5px padding: 10px $flash-message-h-padding + $flash-message-icon-padding 10px $flash-message-h-padding color: white font-weight: bold
  136. _messaging.sass .flash-info @extend .flash-message background: $flash-info-background text-shadow: 0 -1px $flash-info-text-shadow

    .flash-success @extend .flash-message background: $flash-success-background text-shadow: 0 -1px $flash-success-text-shadow .flash-error @extend .flash-message background: $flash-error-background text-shadow: 0 -1px $flash-error-text-shadow li font-weight: normal
  137. _messaging.sass .flash-info @extend .flash-message background: $flash-info-background text-shadow: 0 -1px $flash-info-text-shadow

    .flash-success @extend .flash-message background: $flash-success-background text-shadow: 0 -1px $flash-success-text-shadow .flash-error @extend .flash-message background: $flash-error-background text-shadow: 0 -1px $flash-error-text-shadow li font-weight: normal see
  138. _messaging.sass .flash-info @extend .flash-message background: $flash-info-background text-shadow: 0 -1px $flash-info-text-shadow

    .flash-success @extend .flash-message background: $flash-success-background text-shadow: 0 -1px $flash-success-text-shadow .flash-error @extend .flash-message background: $flash-error-background text-shadow: 0 -1px $flash-error-text-shadow li font-weight: normal see the
  139. _messaging.sass .flash-info @extend .flash-message background: $flash-info-background text-shadow: 0 -1px $flash-info-text-shadow

    .flash-success @extend .flash-message background: $flash-success-background text-shadow: 0 -1px $flash-success-text-shadow .flash-error @extend .flash-message background: $flash-error-background text-shadow: 0 -1px $flash-error-text-shadow li font-weight: normal see the pattern?
  140. _messaging.sass @include flash-message(info, $flash-info-background, $flash-info-text-shadow) @include flash-message(success, $flash-success-background, $flash-success-text-shadow) @include

    flash-message(error, $flash-error-background, $flash-error-text-shadow) @mixin flash-message($type, $background, $text-shadow) .flash-#{$type} @extend .flash-message background: $background text-shadow: 0 -1px $text-shadow @if $type == error li font-weight: normal
  141. _messaging.sass +flash-message(info, $flash-info-background, $flash-info-text-shadow) +flash-message(success, $flash-success-background, $flash-success-text-shadow) +flash-message(error, $flash-error-background, $flash-error-text-shadow)

    =flash-message($type, $background, $text-shadow) .flash-#{$type} @extend .flash-message background: $background text-shadow: 0 -1px $text-shadow @if $type == error li font-weight: normal
  142. _messaging.sass .icon-sprite display: block position: absolute top: 11px right: 12px

    @import "icon/*.png" +all-icon-sprites $icon-sprite-dimensions: true
  143. _messaging.sass .icon-sprite display: block position: absolute top: 11px right: 12px

    @import "icon/*.png" +all-icon-sprites $icon-sprite-dimensions: true
  144. _messaging.sass .icon-sprite display: block position: absolute top: 11px right: 12px

    @import "icon/*.png" +all-icon-sprites $icon-sprite-dimensions: true Compass config file
  145. _messaging.sass .icon-sprite display: block position: absolute top: 11px right: 12px

    @import "icon/*.png" +all-icon-sprites $icon-sprite-dimensions: true config.rb http_path = "/" css_dir = "stylesheets" sass_dir = "sass" images_dir = "images" javascripts_dir = "javascripts" output_style = :nested relative_assets = true line_comments = false Compass config file
  146. _messaging.sass .icon-sprite display: block position: absolute top: 11px right: 12px

    @import "icon/*.png" +all-icon-sprites $icon-sprite-dimensions: true config.rb http_path = "/" css_dir = "stylesheets" sass_dir = "sass" images_dir = "images" javascripts_dir = "javascripts" output_style = :nested relative_assets = true line_comments = false Compass config file
  147. _messaging.sass .icon-sprite display: block position: absolute top: 11px right: 12px

    @import "icon/*.png" +all-icon-sprites $icon-sprite-dimensions: true Compass config file
  148. _messaging.sass .icon-sprite display: block position: absolute top: 11px right: 12px

    @import "icon/*.png" +all-icon-sprites $icon-sprite-dimensions: true generated sprite icon-s5c33447329.png Compass config file
  149. Compiled sprite CSS .icon-sprite, .icon-error, .icon-info, .icon-success { display: block;

    position: absolute; top: 11px; right: 12px; } .icon-sprite, .icon-error, .icon-info, .icon-success { background: url('../images/icon-sa3bc8b9105.png') no-repeat; }
  150. Compiled sprite CSS .icon-sprite, .icon-error, .icon-info, .icon-success { display: block;

    position: absolute; top: 11px; right: 12px; } .icon-sprite, .icon-error, .icon-info, .icon-success { background: url('../images/icon-sa3bc8b9105.png') no-repeat; }
  151. Compiled sprite CSS .icon-sprite, .icon-error, .icon-info, .icon-success { display: block;

    position: absolute; top: 11px; right: 12px; } .icon-sprite, .icon-error, .icon-info, .icon-success { background: url('../images/icon-sa3bc8b9105.png') no-repeat; }
  152. Compiled sprite CSS .icon-sprite, .icon-error, .icon-info, .icon-success { display: block;

    position: absolute; top: 11px; right: 12px; } .icon-sprite, .icon-error, .icon-info, .icon-success { background: url('../images/icon-sa3bc8b9105.png') no-repeat; }
  153. Compiled sprite CSS .icon-sprite, .icon-error, .icon-info, .icon-success { display: block;

    position: absolute; top: 11px; right: 12px; } .icon-sprite, .icon-error, .icon-info, .icon-success { background: url('../images/icon-sa3bc8b9105.png') no-repeat; } .icon-error { background-position: 0 0; height: 19px; width: 20px; } .icon-info { background-position: 0 -19px; height: 21px; width: 20px; } .icon-success { background-position: 0 -40px; height: 21px; width: 20px; }
  154. Compiled sprite CSS .icon-sprite, .icon-error, .icon-info, .icon-success { display: block;

    position: absolute; top: 11px; right: 12px; } .icon-sprite, .icon-error, .icon-info, .icon-success { background: url('../images/icon-sa3bc8b9105.png') no-repeat; } .icon-error { background-position: 0 0; height: 19px; width: 20px; } .icon-info { background-position: 0 -19px; height: 21px; width: 20px; } .icon-success { background-position: 0 -40px; height: 21px; width: 20px; }
  155. Compiled sprite CSS .icon-sprite, .icon-error, .icon-info, .icon-success { display: block;

    position: absolute; top: 11px; right: 12px; } .icon-sprite, .icon-error, .icon-info, .icon-success { background: url('../images/icon-sa3bc8b9105.png') no-repeat; } .icon-error { background-position: 0 0; height: 19px; width: 20px; } .icon-info { background-position: 0 -19px; height: 21px; width: 20px; } .icon-success { background-position: 0 -40px; height: 21px; width: 20px; }
  156. messaging.html <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 pizazz.</li> <li>Password is too easy to hack.</li> <li>You must be at least this tall to ride this ride.</li> </ul> </div>
  157. messaging.html <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 pizazz.</li> <li>Password is too easy to hack.</li> <li>You must be at least this tall to ride this ride.</li> </ul> </div>
  158. messaging.html <div class="flash-info"> <div class="icon-info"></div> <p>You have mail.</p> </div> <div

    class="flash-success"> <div class="icon-success"></div> <p>Settings updated!</p> </div> <div class="flash-error"> <div class="icon-error"></div> <p>Please fix the following errors:</p> <ul> <li>Username requires more pizazz.</li> <li>Password is too easy to hack.</li> <li>You must be at least this tall to ride this ride.</li> </ul> </div>
  159. messaging.html <div class="flash-info"> <div class="icon-info"></div> <p>You have mail.</p> </div> <div

    class="flash-success"> <div class="icon-success"></div> <p>Settings updated!</p> </div> <div class="flash-error"> <div class="icon-error"></div> <p>Please fix the following errors:</p> <ul> <li>Username requires more pizazz.</li> <li>Password is too easy to hack.</li> <li>You must be at least this tall to ride this ride.</li> </ul> </div>
  160. Inline images ul margin-left: 20px $bullet-image: "bullet.png" list-style-image: inline-image($bullet-image, image/png)

    ul { list-style-image: url('data:image/ png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAJCAYAAAAPU20uAAAAT0lEQVR42r3KsQ2AMAxE0ZuA UdIwAPOwldfJJiAxgN344muDQslJv/EzSB5V53tdhsy8uJgM5Pf+eHD3e4UymNkZEc +MuslQ26pW7VNNNgBdFvofIZ4THgAAAABJRU5ErkJggg=='); margin-left: 20px; }
  161. border-radius CSS .flash-message { -moz-border-radius: 5px; -webkit-border-radius: 5px; -o-border-radius: 5px;

    -ms-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px; }
  162. @import compass/css3 .flash-message +border-radius(5px) border-radius Sass CSS .flash-message { -moz-border-radius:

    5px; -webkit-border-radius: 5px; -o-border-radius: 5px; -ms-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px; }
  163. box-shadow .flash-message { -moz-box-shadow: 0 0 3px rgba(0, 0, 0,

    0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; -o-box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; } CSS
  164. box-shadow .flash-message $inner-shadow: 0 0 3px rgba(0, 0, 0, .12)

    inset $inner-shadow-top: 0 1px 0 rgba(0, 0, 0, .05) inset +box-shadow($inner-shadow, $inner-shadow-top) .flash-message { -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; -o-box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; } Sass CSS
  165. box-shadow .flash-message $inner-shadow: 0 0 3px rgba(0, 0, 0, .12)

    inset $inner-shadow-top: 0 1px 0 rgba(0, 0, 0, .05) inset +box-shadow($inner-shadow, $inner-shadow-top) .flash-message { -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; -o-box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; box-shadow: 0 0 3px rgba(0, 0, 0, 0.12) inset, 0 1px 0 rgba(0, 0, 0, 0.05) inset; } Sass CSS
  166. div color: black .foo color: black &.bar color: black &:hover

    color: black .ie7 & color: black .parent & .child color: black Sass
  167. div color: black .foo color: black &.bar color: black &:hover

    color: black .ie7 & color: black .parent & .child color: black div { color: black; } div .foo { color: black; } div.bar { color: black; } div:hover { color: black; } .ie7 div { color: black; } .parent div .child { color: black; } Sass CSS
  168. div color: black .foo color: black &.bar color: black &:hover

    color: black .ie7 & color: black .parent & .child color: black div { color: black; } div .foo { color: black; } div.bar { color: black; } div:hover { color: black; } .ie7 div { color: black; } .parent div .child { color: black; } Sass CSS
  169. div color: black .foo color: black &.bar color: black &:hover

    color: black .ie7 & color: black .parent & .child color: black div { color: black; } div .foo { color: black; } div.bar { color: black; } div:hover { color: black; } .ie7 div { color: black; } .parent div .child { color: black; } Sass CSS
  170. div color: black .foo color: black &.bar color: black &:hover

    color: black .ie7 & color: black .parent & .child color: black div { color: black; } div .foo { color: black; } div.bar { color: black; } div:hover { color: black; } .ie7 div { color: black; } .parent div .child { color: black; } Sass CSS
  171. div color: black .foo color: black &.bar color: black &:hover

    color: black .ie7 & color: black .parent & .child color: black div { color: black; } div .foo { color: black; } div.bar { color: black; } div:hover { color: black; } .ie7 div { color: black; } .parent div .child { color: black; } Sass CSS
  172. div color: black .foo color: black &.bar color: black &:hover

    color: black .ie7 & color: black .parent & .child color: black div { color: black; } div .foo { color: black; } div.bar { color: black; } div:hover { color: black; } .ie7 div { color: black; } .parent div .child { color: black; } Sass CSS
  173. .flash-message a text-decoration: none color: $link-color &:visited color: $link-color &:hover

    color: $link-hover-color text-decoration: underline &:active color: $link-active-color Styling links
  174. .flash-message a text-decoration: none color: $link-color &:visited color: $link-color &:hover

    color: $link-hover-color text-decoration: underline &:active color: $link-active-color Styling links $link-color: #89F2FF $link-hover-color: darken($link-color, 20%) $link-active-color: complement($link-color)
  175. .flash-message a text-decoration: none color: $link-color &:visited color: $link-color &:hover

    color: $link-hover-color text-decoration: underline &:active color: $link-active-color Styling links .flash-message a { text-decoration: none; color: #89f2ff; } .flash-message a:visited { color: #89f2ff; } .flash-message a:hover { color: #23e7ff; text-decoration: underline; } .flash-message a:active { color: #ff9689; } $link-color: #89F2FF $link-hover-color: darken($link-color, 20%) $link-active-color: complement($link-color) Compiled CSS
  176. IE fixes .flash-message background: #f9f9f9 image-url("images/page.png") +box-shadow(0 0 0 3px

    rgba(black, .5)) .ie & +box-shadow(0 0 0 1px rgba(black, .2)) // adjust box-shadow .ie7 & border: 1px solid #e0e0e0 // use border in place of box-shadow background: #f9f9f9 // just background color
  177. IE fixes .flash-message { background: #f9f9f9 url('../images/icon/info.png?1315463945'); -moz-box-shadow: 0 0

    0 3px rgba(0, 0, 0, 0.5); -webkit-box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.5); -o-box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.5); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.5); } .ie .flash-message { -moz-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); -webkit-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); -o-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); } .ie7 .flash-message { border: 1px solid #e0e0e0; background: #f9f9f9; } .flash-message background: #f9f9f9 image-url("images/page.png") +box-shadow(0 0 0 3px rgba(black, .5)) .ie & +box-shadow(0 0 0 1px rgba(black, .2)) // adjust box-shadow .ie7 & border: 1px solid #e0e0e0 // use border in place of box-shadow background: #f9f9f9 // just background color Compiled CSS
  178. Improper @mixin use can cause redundant CSS declarations. Abusing @extend

    and deep nesting will lead to needlessly long selector strings.