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

Designing with SASS

Designing with SASS

A short intro into SASS and a look into how we can use it for advanced design techniques.

Tony Coconate

October 07, 2014
Tweet

More Decks by Tony Coconate

Other Decks in Technology

Transcript

  1. DevMynd Selfie Slide I’m a weekend designer. ! I’m a

    Ruby developer. ! I’m a JavaScript developer. ! I’m a Computer Scientist. ! I’m a recovering milkshake-aholic. ! I’m an open-source contributor.
  2. DevMynd CSS: By The Numbers 98.8135% Websites Using CSS 35.9%‐

    CSS3 Usage Increase 52,181‑ Crazy People Still Using IE6 75.6%‐ Developers Pulling Their Hair Out
  3. DevMynd I just made that all up. ! How could

    I possibly get that sort of data to the fourth decimal place?
  4. DevMynd CSS is moving in the right direction, but for

    now we can use CSS preprocessors to help shim in the functionality that we need in a modern language.
  5. DevMynd .hello { font-family: sans-serif; font-weight: bold; font-size: 24px; text-transform:

    uppercase; line-height: 1.2; color: #ddd; } ! .something { font-family: sans-serif; font-weight: bold; font-size: 24px; text-transform: uppercase; line-height: 1.2; color: #ddd; } ! .something .nested { width: 200px; }
  6. DevMynd $gray: #ddd; ! .hello { font-family: sans-serif; font-weight: bold;

    font-size: 24px; text-transform: uppercase; line-height: 1.2; color: $gray; } ! .something { font-family: sans-serif; font-weight: bold; font-size: 24px; text-transform: uppercase; line-height: 1.2; color: $gray; } ! .something .nested { width: 200px; }
  7. DevMynd $gray: #ddd; ! .hello { font-family: sans-serif; font-weight: bold;

    font-size: 24px; text-transform: uppercase; line-height: 1.2; color: $gray; } ! .something { @extend .hello; } ! .something .nested { width: 200px; }
  8. DevMynd $gray: #ddd; ! .hello { font-family: sans-serif; font-weight: bold;

    font-size: 24px; text-transform: uppercase; line-height: 1.2; color: $gray; } ! .something { @extend .hello; .nested { width: 200px; } }
  9. DevMynd // BEGIN - Screen: Layout // … // Like,

    a billion CSS rules // … // END - Screen: Layout
  10. DevMynd Folders: Separate It Up ├── print/ │ ├── _layout.scss

    │ ├── _typography.scss │ └── _variables.scss ├── screen/ │ ├── _layout.scss │ ├── _mixins.scss │ ├── _typography.scss │ └── _variables.scss ├── print.scss └── screen.scss
  11. DevMynd Partials: Putting Them Together // screen.scss ! @import “bourbon”;

    @import “neat"; @import “screen/variables"; @import “screen/mixins”; @import “screen/typography"; @import “screen/layout";
  12. DevMynd • In the normal content flow, margin: auto; equals

    0 for the top and bottom. ! • position: absolute; breaks the block out of the typical content flow, rendering the rest of the content as if that block weren’t there. ! • Setting top: 0; right: 0; bottom: 0; left: 0; gives the renderer a new bounding box for the block. ! • Giving the block a width or a height prevents the block from taking up all available space and forces the browser to calculate margin: auto; based on the new bounding box.