SlideShare a Scribd company logo
1 of 87
Download to read offline
Curso
        CSS com
     Sass e Compass:
       Introdução
Loiane Groner
http://loiane.com
.msg { padding: 24px; }

.msg h3 {
    padding: 24px;
 }
.msg { padding: 24px; }

.msg h3 {
    padding: 24px;
 }
.msg { padding: 24px; }

.msg h3 {
    padding: 24px;
 }
.msg { padding: 24px; }

.msg h3 {
    padding: 24px;
 }


Problemas
• Repetição gera problemas para manter codigo
• Relacionamentos não estão claros
• Razões para tais valores estão na cabeça de quem fez o
design
Sass é uma extensão do
CSS3 que permite que você
crie folhas de estilo melhores
com um esforço menor
De Sa ss
Pa ra C SS
SCSS - Sassy CSS (.scss)

h1 {
  color: #000;
  background: #fff;
}
Indented Sass (.sass)

h1
     color: #000
     background: #fff
P ense
       ic am ente
Din am
.scss                      .css
$blue: #3bbfce;
$margin: 16px;            /* CSS */

.content-navigation {     .content-navigation {
  border-color: $blue;      border-color: #3bbfce;
  color:                    color: #2b9eab;
    darken($blue, 9%);    }
}
                          .border {
.border {                   padding: 8px;
  padding: $margin / 2;     margin: 8px;
  margin: $margin / 2;      border-color: #3bbfce;
  border-color: $blue;    }
}
D RY
Don’t
Repeat
Yourself
$blue: #3bbfce;
$margin: 16px;

.content-navigation {
  border-color: $blue;
  color:
    darken($blue, 9%);
}

.border {
  padding: $margin / 2;
  margin: $margin / 2;
  border-color: $blue;
}
$blue: #3bbfce;
$margin: 16px;

.content-navigation {
  border-color: $blue;
  color:
    darken($blue, 9%);
}

.border {
  padding: $margin / 2;
  margin: $margin / 2;
  border-color: $blue;
}
$blue: #3bbfce;
$margin: 16px;

.content-navigation {
  border-color: $blue;
  color:
    darken($blue, 9%);
}

.border {
  padding: $margin / 2;
  margin: $margin / 2;
  border-color: $blue;
}
$blue: #3bbfce;
$margin: 16px;

.content-navigation {
  border-color: $blue;
  color:
    darken($blue, 9%);
}

.border {
  padding: $margin / 2;
  margin: $margin / 2;
  border-color: $blue;
}
$blue: #3bbfce;
$margin: 16px;

.content-navigation {
  border-color: $blue;
  color:
    darken($blue, 9%);
}

.border {
  padding: $margin / 2;
  margin: $margin / 2;
  border-color: $blue;
}
$blue: #3bbfce;
$margin: 16px;

.content-navigation {
  border-color: $blue;
  color:
    darken($blue, 9%);
}

.border {
  padding: $margin / 2;
  margin: $margin / 2;
  border-color: $blue;
}
$blue: #3bbfce;
$margin: 16px;

.content-navigation {
  border-color: $blue;
  color:
    darken($blue, 9%);
}

.border {
  padding: $margin / 2;
  margin: $margin / 2;
  border-color: $blue;
}
$blue: #3bbfce;
$margin: 16px;

.content-navigation {
  border-color: $blue;
  color:
    darken($blue, 9%);
}

.border {
  padding: $margin / 2;
  margin: $margin / 2;
  border-color: $blue;
}
Var iáv eis
.scss                        .css
$blue: #3bbfce;
$margin: 16px;            /* CSS */

.content-navigation {     .content-navigation {
  border-color: $blue;      border-color: #3bbfce;
  color:                    color: #2b9eab;
    darken($blue, 9%);    }
}
                          .border {
.border {                   padding: 8px;
  padding: $margin / 2;     margin: 8px;
  margin: $margin / 2;      border-color: #3bbfce;
  border-color: $blue;    }
}
.scss                        .css
$blue: #3bbfce;
$margin: 16px;            /* CSS */

.content-navigation {     .content-navigation {
  border-color: $blue;      border-color: #3bbfce;
  color:                    color: #2b9eab;
    darken($blue, 9%);    }
}
                          .border {
.border {                   padding: 8px;
  padding: $margin / 2;     margin: 8px;
  margin: $margin / 2;      border-color: #3bbfce;
  border-color: $blue;    }
}
.scss                        .css
$blue: #3bbfce;
$margin: 16px;            /* CSS */

.content-navigation {     .content-navigation {
  border-color: $blue;      border-color: #3bbfce;
  color:                    color: #2b9eab;
    darken($blue, 9%);    }
}
                          .border {
.border {                   padding: 8px;
  padding: $margin / 2;     margin: 8px;
  margin: $margin / 2;      border-color: #3bbfce;
  border-color: $blue;    }
}
.scss                        .css
$blue: #3bbfce;
$margin: 16px;            /* CSS */

.content-navigation {     .content-navigation {
  border-color: $blue;      border-color: #3bbfce;
  color:                    color: #2b9eab;
    darken($blue, 9%);    }
}
                          .border {
.border {                   padding: 8px;
  padding: $margin / 2;     margin: 8px;
  margin: $margin / 2;      border-color: #3bbfce;
  border-color: $blue;    }
}
.scss                        .css
$blue: #3bbfce;
$margin: 16px;            /* CSS */

.content-navigation {     .content-navigation {
  border-color: $blue;      border-color: #3bbfce;
  color:                    color: #2b9eab;
    darken($blue, 9%);    }
}
                          .border {
.border {                   padding: 8px;
  padding: $margin / 2;     margin: 8px;
  margin: $margin / 2;      border-color: #3bbfce;
  border-color: $blue;    }
}
.scss                        .css
$blue: #3bbfce;
$margin: 16px;            /* CSS */

.content-navigation {     .content-navigation {
  border-color: $blue;      border-color: #3bbfce;
  color:                    color: #2b9eab;
    darken($blue, 9%);    }
}
                          .border {
.border {                   padding: 8px;
  padding: $margin / 2;     margin: 8px;
  margin: $margin / 2;      border-color: #3bbfce;
  border-color: $blue;    }
}
.scss                        .css
$blue: #3bbfce;
$margin: 16px;            /* CSS */

.content-navigation {     .content-navigation {
  border-color: $blue;      border-color: #3bbfce;
  color:                    color: #2b9eab;
    darken($blue, 9%);    }
}
                          .border {
.border {                   padding: 8px;
  padding: $margin / 2;     margin: 8px;
  margin: $margin / 2;      border-color: #3bbfce;
  border-color: $blue;    }
}
.scss                        .css
$blue: #3bbfce;
$margin: 16px;            /* CSS */

.content-navigation {     .content-navigation {
  border-color: $blue;      border-color: #3bbfce;
  color:                    color: #2b9eab;
    darken($blue, 9%);    }
}
                          .border {
.border {                   padding: 8px;
  padding: $margin / 2;     margin: 8px;
  margin: $margin / 2;      border-color: #3bbfce;
  border-color: $blue;    }
}
Com Sass...
• Não tem repetição -> custo de manuntenção é baixo
• Variáveis deixam os relacionamentos claros
• Razões para tais valores ficam evidentes
Ne sting
.scss                       .css
table.hl {               /* CSS */
  margin: 2em 0;
  td.ln {                table.hl {
    text-align: right;     margin: 2em 0;
  }                      }
}                        table.hl td.ln {
                           text-align: right;
li {                     }
  font: {
     family: serif;      li {
     weight: bold;         font-family: serif;
     size: 1.2em;          font-weight: bold;
  }                        font-size: 1.2em;
}                        }
H er an ça
.scss                     .css
.error {               /* CSS */
  border: 1px #f00;
  background: #fdd;    .error, .badError {
}                        border: 1px #f00;
.error.intrusion {       background: #fdd;
  font-size: 1.3em;    }
  font-weight: bold;
}                      .error.intrusion,
                       .badError.intrusion {
.badError {              font-size: 1.3em;
  @extend .error;        font-weight: bold;
  border-width: 3px;   }
}
                       .badError {
                         border-width: 3px;
                       }
.scss                          .css
   .error {                    /* CSS */
     border: 1px #f00;
     background: #fdd;         .error, .badError {
   }                             border: 1px #f00;
   .error.intrusion {            background: #fdd;
     font-size: 1.3em;         }
     font-weight: bold;
   }                           .error.intrusion,
                               .badError.intrusion {
   .badError {                   font-size: 1.3em;
     @extend .error;             font-weight: bold;
     border-width: 3px;        }
   }
                               .badError {
<div class="error badError">     border-width: 3px;
Erros Graves                   }
</div>
.scss                          .css
   .error {                    /* CSS */
     border: 1px #f00;
     background: #fdd;         .error, .badError {
   }                             border: 1px #f00;
   .error.intrusion {            background: #fdd;
     font-size: 1.3em;         }
     font-weight: bold;
   }                           .error.intrusion,
                               .badError.intrusion {
   .badError {                   font-size: 1.3em;
     @extend .error;             font-weight: bold;
     border-width: 3px;        }
   }
                               .badError {
<div class="error badError">     border-width: 3px;
Erros Graves                   }
</div>
.scss                          .css
   .error {                    /* CSS */
     border: 1px #f00;
     background: #fdd;         .error, .badError {
   }                             border: 1px #f00;
   .error.intrusion {            background: #fdd;
     font-size: 1.3em;         }
     font-weight: bold;
   }                           .error.intrusion,
                               .badError.intrusion {
   .badError {                   font-size: 1.3em;
     @extend .error;             font-weight: bold;
     border-width: 3px;        }
   }
                               .badError {
<div class="error badError">     border-width: 3px;
Erros Graves                   }
</div>
M ix ins
.scss                       .css
@mixin table-base {
  th {                    /* CSS */
    text-align: center;
    font-weight: bold;    #data {
  }                         float: left;
  td, th {padding: 2px}     margin-left: 10px;
}                         }
                          #data th {
@mixin left($dist) {        text-align: center;
  float: left;              font-weight: bold;
  margin-left: $dist;     }
}                         #data td, #data th {
                            padding: 2px;
#data {                   }
  @include left(10px);
  @include table-base;
}
Im ports
/* projeto.scss */
@import "core";
@import "header", "footer";

          sc   ss
  _ core.
             .sc    ss
    _ footer
                    sc   ss
          _h eader.
                                   projeto.css
                    projeto.scss
Opera çõ  es
   tem á tic as
Ma
Operadores Matemáticos

Operadores Matemáticos (+, -, *, /, %) funcionam com
números
2em   +   2em; //4em
2em   -   1em; //1em
1in   +   72pt; //2in
5px   *   4; //20px
19    %   3; //1
Divisão

font: 2px / 2px; //1px
font: 25px / 4+1; //5px
font: $base / 2;
Funções Numéricas

percentage(13/25); //52%
round(4.4); //4
ceil(4.2); //5
floor(4.6); //4
abs(-5); //5
Loo pe
     dic ion ais
C on        es Cond       i ci o n a i s < > <= = > == !=
›O  perador
          else, @    e l se i f
› @if, @
        , @ e a ch , @w h i l e
 › @for
  › and, or
Operadores Relacionais (<, >, <=, >=) comparam
números
1 < 25 // true
10 <= 30 // true
3 > 2     // true
3 >= 2    // true

Operacores de Comparação (==, !=) comparam
qualquer tipo
1 + 1 == 2      // true
small != big    // true
#000 == black // true
red   ==   #f00
red   ==   #ff0000
red   ==   rgb(255, 0, 0)
red   ==   rgba(255, 0, 0, 1.0)
red   ==   hsl(0deg, 100%, 100%)
red   ==   hsla(0deg, 100%, 100%, 1)
@if, @else, @else if
$type: monster;
p {
  @if $type == ocean {
    color: blue;
  } @else if $type == matador {
    color: red;
  } @else if $type == monster {
    color: green;
  } @else {
    color: black;
  }
}
Loop @for
.scss
@for $i from 1 through 3 {
  .item-#{$i} { width: 2em * $i; }
}


.css
.item-1 {
  width: 2em; }
.item-2 {
  width: 4em; }
.item-3 {
  width: 6em; }
Loop @while
.scss
$i: 6;
@while $i > 0 {
  .item-#{$i} { width: 2em * $i; }
  $i: $i - 2;
}

.css
.item-6 {
  width: 12em; }

.item-4 {
  width: 8em; }

.item-2 {
  width: 4em; }
Loop @each
.scss
@each $animal in puma, sea-slug, egret, salamander {
  .#{$animal}-icon {
    background-image: url('/images/#{$animal}.png');
  }
}

.css
.puma-icon {
  background-image:   url('/images/puma.png'); }
.sea-slug-icon {
  background-image:   url('/images/sea-slug.png'); }
.egret-icon {
  background-image:   url('/images/egret.png'); }
.salamander-icon {
  background-image:   url('/images/salamander.png'); }
C ore s!
Função RGBA
.scss
a { color: rgba(blue, .75) }
p { background: rgba(#ffa, .25) }



.css

a { color: rgba(255, 255, 170, 0.25) }
p { background: rgba(255, 255, 170, 0.25) }
Inspecionando Cores
$color: red;
hue($color); //0deg
saturation($color); // 100%
lightness($color); // 50%
red($color); //100
green($color); //0
blue($color); //0
alpha($color); //100
Manipulando Cores
 invert(blue)
 invert(blue)
    invert(blue)
invert(blue)
     invert(blue)        complement(#6cf620)
                          complement(#6cf620)
                             complement(#6cf620)
                         complement(#6cf620)
                              complement(#6cf620)
   invert(blue)
invert(blue)               invert(blue)
                            invert(blue)
                            complement(#6cf620)
                         complement(#6cf620)      co
                                                  co
invert(blue)             complement(#6cf620)


 mix(red, yellow)
    mix(red,yellow) mix(red,yellow, 30%) 30%)
     mix(red,yellow)
              yellow) mix(red, yellow, 30%)
mix(red, yellow)
mix(red, yellow)       mix(red, yellow, 30%)
                          mix(red, yellow, 30%)
                           mix(red, yellow,
   mix(red,
mix(red, yellow)
          yellow)       mix(red, yellow) 30%) mi
                         mix(red, yellow)
                                   yellow,
                      mix(red, yellow, 30%)
                                yellow, 30%)    mi
mix(red,              mix(red,


 grayscale(yellow)
    grayscale(yellow)
     grayscale(yellow)
grayscale(yellow)          grayscale(yellow)
   grayscale(yellow)
grayscale(yellow)
grayscale(yellow)          grayscale(yellow)
grayscale(yellow)
Manipulando HSLA
adjust-hue(#77a7f9,90)
 adjust-hue(#77a7f9,90) adjust-hue(#77a7f9,-90)
                      adjust-hue(#77a7f9,-90)
       adjust-hue(#77a7f9,90)adjust-hue(#77a7f9,90
                              adjust-hue(#77a7f9,-
  adjust-hue(#77a7f9,90) adjust-hue(#77a7f9,-90)
  adjust-hue(#77a7f9,90) adjust-hue(#77a7f9,-90)

 saturate(#9b8a60,50%) desaturate(#d9a621,50%)
                                      adjust-hue(#77
                      adjust-hue(#77a7f9,90) adjust
saturate(#9b8a60,50%) desaturate(#d9a621,50%)
        saturate(#9b8a60,50%) saturate(#9b8a60,50%)
                               desaturate(#d9a621,5
  saturate(#9b8a60,50%) desaturate(#d9a621,50%)
  saturate(#9b8a60,50%)

 darken(#6cf620,30%) desaturate(#d9a621,50%)
                        lighten(#2e7805,50%)
                                      saturate(#9b8a
                      saturate(#9b8a60,50%) desatu
        darken(#6cf620,30%) darken(#6cf620,30%)
  darken(#6cf620,30%)
  darken(#6cf620,30%)          lighten(#2e7805,50%)
                          lighten(#2e7805,50%)
                         lighten(#2e7805,50%)
saturate(#9b8a
                    saturate(#9b8a60,50%) desatur
  saturate(#9b8a60,50%) desaturate(#d9a621,50%)



darken(#6cf620,30%) lighten(#2e7805,50%)
  darken(#6cf620,30%)               darken(#6cf620
                    darken(#6cf620,30%)   lighten
                        lighten(#2e7805,50%)




fade-out(#fab, .5)
 fade-out(#fab, .5) fade-in(rgba(#fab,.5),.5)
  fade-out(#fab, .5) fade-in(rgba(#fab,.5),.5)
                   fade-in(rgba(#fab,.5),.5)
                  fade-out(#fab, .5) fade-in(rgb
                                  fade-out(#fab, .
Mudar a Cor
Pode setar qualquer propriedade de cor



change-color($color, [$red], [$green], [$blue],
[$hue], [$saturation], [$lightness], [$alpha]);
change-color(#ba5637, $hue:60);
    change-color(#ba5637, $hue:60);
   change-color(#ba5637, $hue:60);
    change-color(#ba5637, $hue:60);
  change-color(#ba5637, $hue:60);
                     #19f65d
                   #19f65d
                  #19f65d $hue:60);
  change-color(#ba5637, $hue:60);
   change-color(#ba5637,
                   #19f65d
                 #19f65d
                 #19f65d
                  #19f65d
  change-color(#8e9cb3, $saturation:100);
    change-color(#8e9cb3, $saturation:100);
change-color(#8e9cb3, $saturation:100);
   change-color(#8e9cb3,   $saturation:100);
  change-color(#8e9cb3, $saturation:100);
                 #4288ff $saturation:100);
                   #4288ff$saturation:100);
  change-color(#8e9cb3,
   change-color(#8e9cb3,
                    #4288ff
                  #4288ff
                 #4288ff
                  #4288ff
                   #4288ff
   change-color(#6cf620, $green: 60, $blue: 100);
     change-color(#6cf620, $green: 60, $blue: 100);
change-color(#6cf620,$green: 60,60, $blue:
   change-color(#6cf620, $green: 60,$blue: 100);
    change-color(#6cf620, $green:      $blue: 100);
100);             #6C3C64 $green: 60, $blue: 100);
                    #6C3C64$green: 60, $blue: 100);
   change-color(#6cf620,
    change-color(#6cf620,
                  #6C3C64
                   #6C3C64
                    #6C3C64
                  #6C3C64
                   #6C3C64
Ajustar a Cor
Pode incrementar qualquer propriedade de cor



adjust-color($color, [$red], [$green], [$blue],
[$hue], [$saturation], [$lightness], [$alpha]);
adjust-color(#d3fa7b, $hue:60, $lightness:-20%);
  adjust-color(#d3fa7b, $hue:60, $lightness: -20%);
    adjust-color(#d3fa7b, $hue:60, $lightness: -20%);

                     #19f65d
                 #19f65d
                   #19f65d
 adjust-color(#d3fa7b, $hue:60, $lightness: -20%);
  adjust-color(#d3fa7b, $hue:60, $lightness: -20%);

    adjust-color(#5f8fe3, $green:100, $alpha: -0.25);
  adjust-color(#5f8fe3, $green:100, $alpha: -0.25);
                  #19f65d
                    #19f65d
adjust-color(#5f8fe3, $green:100, $alpha:
                     rgba(95, 255, 227, 0.75); -0.25);
                   rgba(95, 255, 227, 0.75);
 adjust-color(#5f8fe3, $green:100, $alpha: -0.25);
   adjust-color(#5f8fe3, $green:100, $alpha: -0.25);

                rgba(95, 255, 227, 0.75); 0.75);
                 rgba(95, 255, 255, 0.75);
                    rgba(95, 227, 227,
Escalar a Cor
Pode escalar em qualqer porcentagem qualquer propriedade
de cor


scale-color($color, [$red], [$green], [$blue],
[$saturation], [$lightness], [$alpha]);
scale-color(#adf609, $lightness:50%);
  scale-color(#adf609, $lightness:50%);
     scale-color(#adf609, $lightness:50%);
     scale-color(#adf609, $lightness:50%);
                      #d6fa84
                 #d6fa84
                    #d6fa84
                    #d6fa84
  adjust-color(#adf609, $lightness:50%);
     adjust-color(#adf609, $lightness:50%);
adjust-color(#adf609, $lightness:50%);
  scale-color(#adf609, $lightness:50%);
     adjust-color(#adf609, $lightness:50%);
                    white
                 white
                      white
                    white
                 #d6fa84
                                      scale-color adjust-color
                                  scale-color         adjust-c
  adjust-color(#adf609, $lightness:50%);
                                  scale-color         adjust-c


                 white
Funções
.scss

@function pxem($px, $context: 16px) {
  @return ($px / $context) * 1em;
}
article h2 { font-size: pxem(45px); }

.css

article h2 { font-size: 2.813em; }
Compass is an open-source CSS
   Authoring Framework.
Coleção de Mixins
Funções Sass
Ambiente
Extensões
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
fonts_dir = "fonts"
javascripts_dir = "javascripts"
output_style = :compressed
Funções Helper
adjust-lightness, scale-lightness
adjust-saturation, scale-saturation
image-url
image-height
image-width
inline-image
font-url
inline-font-files
pi
sin
cos
tan e mais...
.scss
header {
  background: image-url('hbg.png');
  h1 { width: image-width('logo.png');
       height: image-height('logo.png');
       background: inline-image('logo.png')
  }
}

.css
header {
  background: url('/images/hbg.png?1351...');
}
header h1 { width: 220px; height: 100px;
  background: url('data:image/png;base64...');
}
Mixins
Utilidades
Browser Hacks, Clear!xes, Resets
Estilos para Elementos
Links, Lists, Float, Tables, Text
Design patterns
Tag Cloud, Sticky footer, Vertical rhythm
CSS3
appearance, background, gradients, background-clip background-
origin, background-size, border-radius box, box-shadow,box-sizing,
CSS3 PIE, columns, font-face, opacity, transform, transition, more...
.scss
.msg {
@include background(linear-gradient(#fff, #eee));
  @include border-radius(5px);
}
   .css
.msg {
background: -webkit-gradient(linear, 50% 0%, 50% 100%,
color-stop(0%, #ffffff), color-stop(100%, #eeeeee));
background: -webkit-linear-gradient(#ffffff, #eeeeee);
background: -moz-linear-gradient(#ffffff, #eeeeee);
background: -ms-linear-gradient(#ffffff, #eeeeee);
background: linear-gradient(#ffffff, #eeeeee);
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-ms-border-radius: 5px;
border-radius: 5px; }
Plugins e Extensões

Fancy Buttons, Sassy Buttons - botões CSS3
Animate - lib para animação em CSS3
RGBApng - Gerar alpha pngs a partir do Sass
Compass Magick - Renderiza gradientes CSS3
Gradients para png
Qu em
usa?
Referências Sass

http://sass-lang.com/

http://sass-lang.com/docs/yardoc/
    file.SASS_REFERENCE.html


http://thesassway.com/
Referências Compass

http://compass-style.org/



http://compass-style.org/reference/
             compass/
http://groups.google.com/
     group/sass-lang
.contato {
   email: ‘curso@extjs4.com’;
   blog: ‘loiane.com’;
   facebook: ‘facebook.com/loianegroner’;
   twitter: ‘@loiane’;
   github: ‘loiane’;
   vimeo: ‘loiane’;
   youtube: ‘loianeg’;
 }
Obrigada!

More Related Content

Similar to Curso CSS3 com Sass e Compass - Aula 01 - Introducão

Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with SassRob Friesel
 
Sass - Making CSS fun again.
Sass - Making CSS fun again.Sass - Making CSS fun again.
Sass - Making CSS fun again.Gabriel Neutzling
 
Software programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesSoftware programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesDinu Suman
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & CompassAndreas Dantz
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESSjsmith92
 
CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書拓樹 谷
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)emrox
 
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and CompassBringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and CompassClaudina Sarahe
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSSSayanee Basu
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & CompassRob Davarnia
 
Learn to Love CSS3 [English]
Learn to Love CSS3 [English]Learn to Love CSS3 [English]
Learn to Love CSS3 [English]ThemePartner
 
Dojo: Sass - Syntactically Awesome Stylesheets
Dojo: Sass - Syntactically Awesome StylesheetsDojo: Sass - Syntactically Awesome Stylesheets
Dojo: Sass - Syntactically Awesome StylesheetsGuilherme
 

Similar to Curso CSS3 com Sass e Compass - Aula 01 - Introducão (20)

Theming and Sass
Theming and SassTheming and Sass
Theming and Sass
 
Wrangling the CSS Beast with Sass
Wrangling the CSS Beast  with SassWrangling the CSS Beast  with Sass
Wrangling the CSS Beast with Sass
 
Sass&compass
Sass&compassSass&compass
Sass&compass
 
Css frameworks
Css frameworksCss frameworks
Css frameworks
 
FCIP SASS Talk
FCIP SASS TalkFCIP SASS Talk
FCIP SASS Talk
 
Sass - Making CSS fun again.
Sass - Making CSS fun again.Sass - Making CSS fun again.
Sass - Making CSS fun again.
 
Software programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS filesSoftware programming tools for creating/managing CSS files
Software programming tools for creating/managing CSS files
 
Work and play with SASS & Compass
Work and play with SASS & CompassWork and play with SASS & Compass
Work and play with SASS & Compass
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESS
 
CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書
 
Less css
Less cssLess css
Less css
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and CompassBringing sexy back to CSS: SASS/SCSS, LESS and Compass
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSS
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
Less & Sass
Less & SassLess & Sass
Less & Sass
 
Learn to Love CSS3 [English]
Learn to Love CSS3 [English]Learn to Love CSS3 [English]
Learn to Love CSS3 [English]
 
Dojo: Sass - Syntactically Awesome Stylesheets
Dojo: Sass - Syntactically Awesome StylesheetsDojo: Sass - Syntactically Awesome Stylesheets
Dojo: Sass - Syntactically Awesome Stylesheets
 
Sass
SassSass
Sass
 

Recently uploaded

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Recently uploaded (20)

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Curso CSS3 com Sass e Compass - Aula 01 - Introducão

  • 1. Curso CSS com Sass e Compass: Introdução Loiane Groner http://loiane.com
  • 2.
  • 3. .msg { padding: 24px; } .msg h3 { padding: 24px; }
  • 4. .msg { padding: 24px; } .msg h3 { padding: 24px; }
  • 5. .msg { padding: 24px; } .msg h3 { padding: 24px; }
  • 6. .msg { padding: 24px; } .msg h3 { padding: 24px; } Problemas • Repetição gera problemas para manter codigo • Relacionamentos não estão claros • Razões para tais valores estão na cabeça de quem fez o design
  • 7.
  • 8. Sass é uma extensão do CSS3 que permite que você crie folhas de estilo melhores com um esforço menor
  • 9. De Sa ss Pa ra C SS
  • 10. SCSS - Sassy CSS (.scss) h1 { color: #000; background: #fff; }
  • 11. Indented Sass (.sass) h1 color: #000 background: #fff
  • 12. P ense ic am ente Din am
  • 13. .scss .css $blue: #3bbfce; $margin: 16px; /* CSS */ .content-navigation { .content-navigation { border-color: $blue; border-color: #3bbfce; color: color: #2b9eab; darken($blue, 9%); } } .border { .border { padding: 8px; padding: $margin / 2; margin: 8px; margin: $margin / 2; border-color: #3bbfce; border-color: $blue; } }
  • 14. D RY
  • 16. $blue: #3bbfce; $margin: 16px; .content-navigation { border-color: $blue; color: darken($blue, 9%); } .border { padding: $margin / 2; margin: $margin / 2; border-color: $blue; }
  • 17. $blue: #3bbfce; $margin: 16px; .content-navigation { border-color: $blue; color: darken($blue, 9%); } .border { padding: $margin / 2; margin: $margin / 2; border-color: $blue; }
  • 18. $blue: #3bbfce; $margin: 16px; .content-navigation { border-color: $blue; color: darken($blue, 9%); } .border { padding: $margin / 2; margin: $margin / 2; border-color: $blue; }
  • 19. $blue: #3bbfce; $margin: 16px; .content-navigation { border-color: $blue; color: darken($blue, 9%); } .border { padding: $margin / 2; margin: $margin / 2; border-color: $blue; }
  • 20. $blue: #3bbfce; $margin: 16px; .content-navigation { border-color: $blue; color: darken($blue, 9%); } .border { padding: $margin / 2; margin: $margin / 2; border-color: $blue; }
  • 21. $blue: #3bbfce; $margin: 16px; .content-navigation { border-color: $blue; color: darken($blue, 9%); } .border { padding: $margin / 2; margin: $margin / 2; border-color: $blue; }
  • 22. $blue: #3bbfce; $margin: 16px; .content-navigation { border-color: $blue; color: darken($blue, 9%); } .border { padding: $margin / 2; margin: $margin / 2; border-color: $blue; }
  • 23. $blue: #3bbfce; $margin: 16px; .content-navigation { border-color: $blue; color: darken($blue, 9%); } .border { padding: $margin / 2; margin: $margin / 2; border-color: $blue; }
  • 25. .scss .css $blue: #3bbfce; $margin: 16px; /* CSS */ .content-navigation { .content-navigation { border-color: $blue; border-color: #3bbfce; color: color: #2b9eab; darken($blue, 9%); } } .border { .border { padding: 8px; padding: $margin / 2; margin: 8px; margin: $margin / 2; border-color: #3bbfce; border-color: $blue; } }
  • 26. .scss .css $blue: #3bbfce; $margin: 16px; /* CSS */ .content-navigation { .content-navigation { border-color: $blue; border-color: #3bbfce; color: color: #2b9eab; darken($blue, 9%); } } .border { .border { padding: 8px; padding: $margin / 2; margin: 8px; margin: $margin / 2; border-color: #3bbfce; border-color: $blue; } }
  • 27. .scss .css $blue: #3bbfce; $margin: 16px; /* CSS */ .content-navigation { .content-navigation { border-color: $blue; border-color: #3bbfce; color: color: #2b9eab; darken($blue, 9%); } } .border { .border { padding: 8px; padding: $margin / 2; margin: 8px; margin: $margin / 2; border-color: #3bbfce; border-color: $blue; } }
  • 28. .scss .css $blue: #3bbfce; $margin: 16px; /* CSS */ .content-navigation { .content-navigation { border-color: $blue; border-color: #3bbfce; color: color: #2b9eab; darken($blue, 9%); } } .border { .border { padding: 8px; padding: $margin / 2; margin: 8px; margin: $margin / 2; border-color: #3bbfce; border-color: $blue; } }
  • 29. .scss .css $blue: #3bbfce; $margin: 16px; /* CSS */ .content-navigation { .content-navigation { border-color: $blue; border-color: #3bbfce; color: color: #2b9eab; darken($blue, 9%); } } .border { .border { padding: 8px; padding: $margin / 2; margin: 8px; margin: $margin / 2; border-color: #3bbfce; border-color: $blue; } }
  • 30. .scss .css $blue: #3bbfce; $margin: 16px; /* CSS */ .content-navigation { .content-navigation { border-color: $blue; border-color: #3bbfce; color: color: #2b9eab; darken($blue, 9%); } } .border { .border { padding: 8px; padding: $margin / 2; margin: 8px; margin: $margin / 2; border-color: #3bbfce; border-color: $blue; } }
  • 31. .scss .css $blue: #3bbfce; $margin: 16px; /* CSS */ .content-navigation { .content-navigation { border-color: $blue; border-color: #3bbfce; color: color: #2b9eab; darken($blue, 9%); } } .border { .border { padding: 8px; padding: $margin / 2; margin: 8px; margin: $margin / 2; border-color: #3bbfce; border-color: $blue; } }
  • 32. .scss .css $blue: #3bbfce; $margin: 16px; /* CSS */ .content-navigation { .content-navigation { border-color: $blue; border-color: #3bbfce; color: color: #2b9eab; darken($blue, 9%); } } .border { .border { padding: 8px; padding: $margin / 2; margin: 8px; margin: $margin / 2; border-color: #3bbfce; border-color: $blue; } }
  • 33. Com Sass... • Não tem repetição -> custo de manuntenção é baixo • Variáveis deixam os relacionamentos claros • Razões para tais valores ficam evidentes
  • 35. .scss .css table.hl { /* CSS */ margin: 2em 0; td.ln { table.hl { text-align: right; margin: 2em 0; } } } table.hl td.ln { text-align: right; li { } font: { family: serif; li { weight: bold; font-family: serif; size: 1.2em; font-weight: bold; } font-size: 1.2em; } }
  • 36. H er an ça
  • 37. .scss .css .error { /* CSS */ border: 1px #f00; background: #fdd; .error, .badError { } border: 1px #f00; .error.intrusion { background: #fdd; font-size: 1.3em; } font-weight: bold; } .error.intrusion, .badError.intrusion { .badError { font-size: 1.3em; @extend .error; font-weight: bold; border-width: 3px; } } .badError { border-width: 3px; }
  • 38. .scss .css .error { /* CSS */ border: 1px #f00; background: #fdd; .error, .badError { } border: 1px #f00; .error.intrusion { background: #fdd; font-size: 1.3em; } font-weight: bold; } .error.intrusion, .badError.intrusion { .badError { font-size: 1.3em; @extend .error; font-weight: bold; border-width: 3px; } } .badError { <div class="error badError"> border-width: 3px; Erros Graves } </div>
  • 39. .scss .css .error { /* CSS */ border: 1px #f00; background: #fdd; .error, .badError { } border: 1px #f00; .error.intrusion { background: #fdd; font-size: 1.3em; } font-weight: bold; } .error.intrusion, .badError.intrusion { .badError { font-size: 1.3em; @extend .error; font-weight: bold; border-width: 3px; } } .badError { <div class="error badError"> border-width: 3px; Erros Graves } </div>
  • 40. .scss .css .error { /* CSS */ border: 1px #f00; background: #fdd; .error, .badError { } border: 1px #f00; .error.intrusion { background: #fdd; font-size: 1.3em; } font-weight: bold; } .error.intrusion, .badError.intrusion { .badError { font-size: 1.3em; @extend .error; font-weight: bold; border-width: 3px; } } .badError { <div class="error badError"> border-width: 3px; Erros Graves } </div>
  • 42. .scss .css @mixin table-base { th { /* CSS */ text-align: center; font-weight: bold; #data { } float: left; td, th {padding: 2px} margin-left: 10px; } } #data th { @mixin left($dist) { text-align: center; float: left; font-weight: bold; margin-left: $dist; } } #data td, #data th { padding: 2px; #data { } @include left(10px); @include table-base; }
  • 44. /* projeto.scss */ @import "core"; @import "header", "footer"; sc ss _ core. .sc ss _ footer sc ss _h eader. projeto.css projeto.scss
  • 45. Opera çõ es tem á tic as Ma
  • 46. Operadores Matemáticos Operadores Matemáticos (+, -, *, /, %) funcionam com números 2em + 2em; //4em 2em - 1em; //1em 1in + 72pt; //2in 5px * 4; //20px 19 % 3; //1
  • 47. Divisão font: 2px / 2px; //1px font: 25px / 4+1; //5px font: $base / 2;
  • 48. Funções Numéricas percentage(13/25); //52% round(4.4); //4 ceil(4.2); //5 floor(4.6); //4 abs(-5); //5
  • 49. Loo pe dic ion ais C on es Cond i ci o n a i s < > <= = > == != ›O perador else, @ e l se i f › @if, @ , @ e a ch , @w h i l e › @for › and, or
  • 50. Operadores Relacionais (<, >, <=, >=) comparam números 1 < 25 // true 10 <= 30 // true 3 > 2 // true 3 >= 2 // true Operacores de Comparação (==, !=) comparam qualquer tipo 1 + 1 == 2 // true small != big // true #000 == black // true
  • 51. red == #f00 red == #ff0000 red == rgb(255, 0, 0) red == rgba(255, 0, 0, 1.0) red == hsl(0deg, 100%, 100%) red == hsla(0deg, 100%, 100%, 1)
  • 52. @if, @else, @else if $type: monster; p { @if $type == ocean { color: blue; } @else if $type == matador { color: red; } @else if $type == monster { color: green; } @else { color: black; } }
  • 53. Loop @for .scss @for $i from 1 through 3 { .item-#{$i} { width: 2em * $i; } } .css .item-1 { width: 2em; } .item-2 { width: 4em; } .item-3 { width: 6em; }
  • 54. Loop @while .scss $i: 6; @while $i > 0 { .item-#{$i} { width: 2em * $i; } $i: $i - 2; } .css .item-6 { width: 12em; } .item-4 { width: 8em; } .item-2 { width: 4em; }
  • 55. Loop @each .scss @each $animal in puma, sea-slug, egret, salamander { .#{$animal}-icon { background-image: url('/images/#{$animal}.png'); } } .css .puma-icon { background-image: url('/images/puma.png'); } .sea-slug-icon { background-image: url('/images/sea-slug.png'); } .egret-icon { background-image: url('/images/egret.png'); } .salamander-icon { background-image: url('/images/salamander.png'); }
  • 57. Função RGBA .scss a { color: rgba(blue, .75) } p { background: rgba(#ffa, .25) } .css a { color: rgba(255, 255, 170, 0.25) } p { background: rgba(255, 255, 170, 0.25) }
  • 58. Inspecionando Cores $color: red; hue($color); //0deg saturation($color); // 100% lightness($color); // 50% red($color); //100 green($color); //0 blue($color); //0 alpha($color); //100
  • 59. Manipulando Cores invert(blue) invert(blue) invert(blue) invert(blue) invert(blue) complement(#6cf620) complement(#6cf620) complement(#6cf620) complement(#6cf620) complement(#6cf620) invert(blue) invert(blue) invert(blue) invert(blue) complement(#6cf620) complement(#6cf620) co co invert(blue) complement(#6cf620) mix(red, yellow) mix(red,yellow) mix(red,yellow, 30%) 30%) mix(red,yellow) yellow) mix(red, yellow, 30%) mix(red, yellow) mix(red, yellow) mix(red, yellow, 30%) mix(red, yellow, 30%) mix(red, yellow, mix(red, mix(red, yellow) yellow) mix(red, yellow) 30%) mi mix(red, yellow) yellow, mix(red, yellow, 30%) yellow, 30%) mi mix(red, mix(red, grayscale(yellow) grayscale(yellow) grayscale(yellow) grayscale(yellow) grayscale(yellow) grayscale(yellow) grayscale(yellow) grayscale(yellow) grayscale(yellow) grayscale(yellow)
  • 60. Manipulando HSLA adjust-hue(#77a7f9,90) adjust-hue(#77a7f9,90) adjust-hue(#77a7f9,-90) adjust-hue(#77a7f9,-90) adjust-hue(#77a7f9,90)adjust-hue(#77a7f9,90 adjust-hue(#77a7f9,- adjust-hue(#77a7f9,90) adjust-hue(#77a7f9,-90) adjust-hue(#77a7f9,90) adjust-hue(#77a7f9,-90) saturate(#9b8a60,50%) desaturate(#d9a621,50%) adjust-hue(#77 adjust-hue(#77a7f9,90) adjust saturate(#9b8a60,50%) desaturate(#d9a621,50%) saturate(#9b8a60,50%) saturate(#9b8a60,50%) desaturate(#d9a621,5 saturate(#9b8a60,50%) desaturate(#d9a621,50%) saturate(#9b8a60,50%) darken(#6cf620,30%) desaturate(#d9a621,50%) lighten(#2e7805,50%) saturate(#9b8a saturate(#9b8a60,50%) desatu darken(#6cf620,30%) darken(#6cf620,30%) darken(#6cf620,30%) darken(#6cf620,30%) lighten(#2e7805,50%) lighten(#2e7805,50%) lighten(#2e7805,50%)
  • 61. saturate(#9b8a saturate(#9b8a60,50%) desatur saturate(#9b8a60,50%) desaturate(#d9a621,50%) darken(#6cf620,30%) lighten(#2e7805,50%) darken(#6cf620,30%) darken(#6cf620 darken(#6cf620,30%) lighten lighten(#2e7805,50%) fade-out(#fab, .5) fade-out(#fab, .5) fade-in(rgba(#fab,.5),.5) fade-out(#fab, .5) fade-in(rgba(#fab,.5),.5) fade-in(rgba(#fab,.5),.5) fade-out(#fab, .5) fade-in(rgb fade-out(#fab, .
  • 62. Mudar a Cor Pode setar qualquer propriedade de cor change-color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha]);
  • 63. change-color(#ba5637, $hue:60); change-color(#ba5637, $hue:60); change-color(#ba5637, $hue:60); change-color(#ba5637, $hue:60); change-color(#ba5637, $hue:60); #19f65d #19f65d #19f65d $hue:60); change-color(#ba5637, $hue:60); change-color(#ba5637, #19f65d #19f65d #19f65d #19f65d change-color(#8e9cb3, $saturation:100); change-color(#8e9cb3, $saturation:100); change-color(#8e9cb3, $saturation:100); change-color(#8e9cb3, $saturation:100); change-color(#8e9cb3, $saturation:100); #4288ff $saturation:100); #4288ff$saturation:100); change-color(#8e9cb3, change-color(#8e9cb3, #4288ff #4288ff #4288ff #4288ff #4288ff change-color(#6cf620, $green: 60, $blue: 100); change-color(#6cf620, $green: 60, $blue: 100); change-color(#6cf620,$green: 60,60, $blue: change-color(#6cf620, $green: 60,$blue: 100); change-color(#6cf620, $green: $blue: 100); 100); #6C3C64 $green: 60, $blue: 100); #6C3C64$green: 60, $blue: 100); change-color(#6cf620, change-color(#6cf620, #6C3C64 #6C3C64 #6C3C64 #6C3C64 #6C3C64
  • 64. Ajustar a Cor Pode incrementar qualquer propriedade de cor adjust-color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha]);
  • 65. adjust-color(#d3fa7b, $hue:60, $lightness:-20%); adjust-color(#d3fa7b, $hue:60, $lightness: -20%); adjust-color(#d3fa7b, $hue:60, $lightness: -20%); #19f65d #19f65d #19f65d adjust-color(#d3fa7b, $hue:60, $lightness: -20%); adjust-color(#d3fa7b, $hue:60, $lightness: -20%); adjust-color(#5f8fe3, $green:100, $alpha: -0.25); adjust-color(#5f8fe3, $green:100, $alpha: -0.25); #19f65d #19f65d adjust-color(#5f8fe3, $green:100, $alpha: rgba(95, 255, 227, 0.75); -0.25); rgba(95, 255, 227, 0.75); adjust-color(#5f8fe3, $green:100, $alpha: -0.25); adjust-color(#5f8fe3, $green:100, $alpha: -0.25); rgba(95, 255, 227, 0.75); 0.75); rgba(95, 255, 255, 0.75); rgba(95, 227, 227,
  • 66. Escalar a Cor Pode escalar em qualqer porcentagem qualquer propriedade de cor scale-color($color, [$red], [$green], [$blue], [$saturation], [$lightness], [$alpha]);
  • 67. scale-color(#adf609, $lightness:50%); scale-color(#adf609, $lightness:50%); scale-color(#adf609, $lightness:50%); scale-color(#adf609, $lightness:50%); #d6fa84 #d6fa84 #d6fa84 #d6fa84 adjust-color(#adf609, $lightness:50%); adjust-color(#adf609, $lightness:50%); adjust-color(#adf609, $lightness:50%); scale-color(#adf609, $lightness:50%); adjust-color(#adf609, $lightness:50%); white white white white #d6fa84 scale-color adjust-color scale-color adjust-c adjust-color(#adf609, $lightness:50%); scale-color adjust-c white
  • 69. .scss @function pxem($px, $context: 16px) { @return ($px / $context) * 1em; } article h2 { font-size: pxem(45px); } .css article h2 { font-size: 2.813em; }
  • 70.
  • 71. Compass is an open-source CSS Authoring Framework.
  • 72. Coleção de Mixins Funções Sass Ambiente Extensões
  • 73. http_path = "/" css_dir = "stylesheets" sass_dir = "sass" images_dir = "images" fonts_dir = "fonts" javascripts_dir = "javascripts" output_style = :compressed
  • 74. Funções Helper adjust-lightness, scale-lightness adjust-saturation, scale-saturation image-url image-height image-width inline-image font-url inline-font-files pi sin cos tan e mais...
  • 75. .scss header { background: image-url('hbg.png'); h1 { width: image-width('logo.png'); height: image-height('logo.png'); background: inline-image('logo.png') } } .css header { background: url('/images/hbg.png?1351...'); } header h1 { width: 220px; height: 100px; background: url('data:image/png;base64...'); }
  • 76. Mixins Utilidades Browser Hacks, Clear!xes, Resets Estilos para Elementos Links, Lists, Float, Tables, Text Design patterns Tag Cloud, Sticky footer, Vertical rhythm CSS3 appearance, background, gradients, background-clip background- origin, background-size, border-radius box, box-shadow,box-sizing, CSS3 PIE, columns, font-face, opacity, transform, transition, more...
  • 77. .scss .msg { @include background(linear-gradient(#fff, #eee)); @include border-radius(5px); } .css .msg { background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #eeeeee)); background: -webkit-linear-gradient(#ffffff, #eeeeee); background: -moz-linear-gradient(#ffffff, #eeeeee); background: -ms-linear-gradient(#ffffff, #eeeeee); background: linear-gradient(#ffffff, #eeeeee); -moz-border-radius: 5px; -webkit-border-radius: 5px; -ms-border-radius: 5px; border-radius: 5px; }
  • 78. Plugins e Extensões Fancy Buttons, Sassy Buttons - botões CSS3 Animate - lib para animação em CSS3 RGBApng - Gerar alpha pngs a partir do Sass Compass Magick - Renderiza gradientes CSS3 Gradients para png
  • 80.
  • 81.
  • 82. Referências Sass http://sass-lang.com/ http://sass-lang.com/docs/yardoc/ file.SASS_REFERENCE.html http://thesassway.com/
  • 84.
  • 85. http://groups.google.com/ group/sass-lang
  • 86. .contato { email: ‘curso@extjs4.com’; blog: ‘loiane.com’; facebook: ‘facebook.com/loianegroner’; twitter: ‘@loiane’; github: ‘loiane’; vimeo: ‘loiane’; youtube: ‘loianeg’; }