CSS Study Group 2

CSS Study Group 2

2956e2cd2664630aa968b92bbb645f2f?s=128

Kerrick Long

October 30, 2014
Tweet

Transcript

  1. 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
  2. 4.
  3. 6.
  4. 7.
  5. 8.

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

    (min-width: 481px) { /* large-screen styles */ .header { width: 50%; } }
  6. 14.
  7. 15.
  8. 28.
  9. 30.

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

    } } .foo { color: blue; } .foo .bar { color: red; }
  10. 31.

    NESTED PARENT SELECTOR .foo { color: blue; &:hover { color:

    red; } } .foo { color: blue; } .foo:hover { color: red; }
  11. 32.

    NESTED PARENT SELECTOR .foo { color: blue; .baz & {

    color: red; } } .foo { color: blue; } .baz .foo { color: red; }
  12. 33.

    NESTED @AT-ROOT .foo { color: blue; @at-root .bar { color:

    red; } } .foo { color: blue; } .bar { color: red; }
  13. 34.

    NESTED MEDIA QUERIES .foo { color: blue; @media (screen) {

    color: red; } } .foo { color: blue; } @media (screen) { .foo { color: red; } }
  14. 36.

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

    background: $red; } .foo { color: #f01903; } .bar { background: #f01903; }
  15. 37.

    VARIABLE SCOPE $red: #f01903; .foo { $red: #a12014; color: $red;

    } .bar { background: $red; } .foo { color: #a12014; } .bar { background: #f01903; }
  16. 38.

    VARIABLE DEFAULT $red: #f01903; .foo { $red: #a12014 !default; color:

    $red; } .bar { background: $red; } .foo { color: #f01903; } .bar { background: #f01903; }
  17. 40.
  18. 41.

    @EXTEND EVERYWHERE .foo { color: red; &:hover { border: 0

    } } .bar { @extend .foo; } .foo, .bar { color: red; } .foo:hover, .bar:hover { border: 0; }
  19. 43.

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

    color: blue; } .bar { color: blue; } .foo { color: red; } _bar.scss foo.scss foo.css
  20. 46.
  21. 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. */ }
  22. 49.

    NAMED ARGUMENTS @mixin foo($a, $b) { /* stuff */ }

    .bar { @include foo($b: 1); } .baz { @include foo($b: 1, $a: 2); } .bar { /* stuff */ } .baz { /* stuff */ }
  23. 51.

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

    true @if (true) { /* stuff */ } @else if { /* other stuff */ } @else { /* more stuff */ }
  24. 52.
  25. 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; }
  26. 55.

    CSS3 PREFIX MIX-INS Animation Appearance Background Size Box Shadow Box

    Sizing Font Face Filter Opacity Transform Transition Text Shadow Columns
  27. 57.

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

    background: url('// media.secondstreet.com/ StaticContent/images/a.png'); }
  28. 58.

    COMPASS UTILITIES Saturation Lightness Color Stops Prefixes Inline Images Font

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