CSS Study Group 2

CSS Study Group 2

2956e2cd2664630aa968b92bbb645f2f?s=128

Kerrick Long

October 30, 2014
Tweet

Transcript

  1. CSS3 & SASS CSS STUDY GROUP WITH COMPASS

  2. Kerrick Long Things I make and do Where to find

    me online meetup.com/STLEmber Lead Front-end Developer at Second Street www. .com twitter.com/KerrickLong github.com/Kerrick
  3. selector { -prefix-property: value; selector { @include mixin($arg: 3); }

    }
  4. CSS 3

  5. CSS LEVEL 3 MEDIA QUERIES

  6. None
  7. None
  8. /* small-screen styles */ .header { width: 100%; } @media

    (min-width: 481px) { /* large-screen styles */ .header { width: 50%; } }
  9. @media (min-width: 481px) { .header { width: 50%; } }

    LOGICAL IF
  10. @media (min-width: 481px) and (max-width: 1280px) { .header { width:

    50%; } } LOGICAL AND
  11. @media (min-width: 481px), (max-width: 1280px) { .header { width: 50%;

    } } LOGICAL OR
  12. @media not all and (min-width: 481px) { .header { width:

    50%; } } LOGICAL NOT
  13. CSS LEVEL 3 VENDOR PREFIXES

  14. None
  15. None
  16. .button, button { border-radius: 3px; }

  17. .button, button { border-radius: 3px; -ms-border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius:

    3px; }
  18. .button, button { border-radius: 3px; -ms-border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius:

    3px; }
  19. CSS LEVEL 3 MODULES

  20. CSS 3 BACKGROUNDS

  21. CSS 3 BACKGROUNDS

  22. CSS 3 BACKGROUNDS

  23. CSS 3 FONTS Web-safe Fonts

  24. CSS 3 FONTS Awesome Fonts! @font-face { font-family: 'Jazz'; src:

    url('jazz.woff') format('woff') }
  25. CSS 3 BORDER-RADIUS

  26. CSS 3 BOX-SHADOW

  27. CSS 3 OPACITY

  28. SASS

  29. SASSY CSS NESTING

  30. NESTING BASICS .foo { color: blue; .bar { color: red;

    } } .foo { color: blue; } .foo .bar { color: red; }
  31. NESTED PARENT SELECTOR .foo { color: blue; &:hover { color:

    red; } } .foo { color: blue; } .foo:hover { color: red; }
  32. NESTED PARENT SELECTOR .foo { color: blue; .baz & {

    color: red; } } .foo { color: blue; } .baz .foo { color: red; }
  33. NESTED @AT-ROOT .foo { color: blue; @at-root .bar { color:

    red; } } .foo { color: blue; } .bar { color: red; }
  34. NESTED MEDIA QUERIES .foo { color: blue; @media (screen) {

    color: red; } } .foo { color: blue; } @media (screen) { .foo { color: red; } }
  35. SASSY CSS VARIABLES

  36. VARIABLES $red: #f01903; .foo { color: $red; } .bar {

    background: $red; } .foo { color: #f01903; } .bar { background: #f01903; }
  37. VARIABLE SCOPE $red: #f01903; .foo { $red: #a12014; color: $red;

    } .bar { background: $red; } .foo { color: #a12014; } .bar { background: #f01903; }
  38. VARIABLE DEFAULT $red: #f01903; .foo { $red: #a12014 !default; color:

    $red; } .bar { background: $red; } .foo { color: #f01903; } .bar { background: #f01903; }
  39. SASSY CSS @EXTEND

  40. @EXTEND .foo { color: red; } .bar { @extend .foo;

    } .foo, .bar { color: red; }
  41. @EXTEND EVERYWHERE .foo { color: red; &:hover { border: 0

    } } .bar { @extend .foo; } .foo, .bar { color: red; } .foo:hover, .bar:hover { border: 0; }
  42. SASSY CSS @IMPORT

  43. @IMPORT @import "bar"; .foo { color: red; } .bar {

    color: blue; } .bar { color: blue; } .foo { color: red; } _bar.scss foo.scss foo.css
  44. @IMPORT foo.scss _bar.scss foo.css

  45. SASSY CSS MIX-INS

  46. USING MIX-INS .foo { @include button(3px); } .foo { border-radius:

    3px; display: inline-block; /* etc. */ }
  47. CREATING MIX-INS @mixin button($radius) { border-radius: $radius; display: inline-block; /*

    etc. */ }
  48. DEFAULT ARGUMENTS @mixin button($radius: 3px) { border-radius: $radius; display: inline-block;

    /* etc. */ } .button { @include button } .round { @include button(8px) } .button { border-radius: 3px; display: inline-block; /* etc. */ } .round { border-radius: 8px; display: inline-block; /* etc. */ }
  49. NAMED ARGUMENTS @mixin foo($a, $b) { /* stuff */ }

    .bar { @include foo($b: 1); } .baz { @include foo($b: 1, $a: 2); } .bar { /* stuff */ } .baz { /* stuff */ }
  50. SASSY CSS SASS SCRIPT

  51. NESTING BASICS "string #{$interpolation}" 10 * 10 <= 150 //

    true @if (true) { /* stuff */ } @else if { /* other stuff */ } @else { /* more stuff */ }
  52. COMPASS

  53. COMPASS STYLE CSS 3

  54. CSS3 PREFIX MIX-INS @import "compass/css3"; .foo { @include border-radius(3px); }

    .foo { border-radius: 3px; -o-border-radius: 3px; -ms-border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; }
  55. CSS3 PREFIX MIX-INS Animation Appearance Background Size Box Shadow Box

    Sizing Font Face Filter Opacity Transform Transition Text Shadow Columns
  56. COMPASS STYLE HELPERS

  57. CSS3 PREFIX MIX-INS .foo { background: image-url('a.png'); } .foo {

    background: url('// media.secondstreet.com/ StaticContent/images/a.png'); }
  58. COMPASS UTILITIES Saturation Lightness Color Stops Prefixes Inline Images Font

    Face √ Tint sin/cos/tan Enumerate Image URL Font Files
  59. None