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

Os paranauês do CSS3

Os paranauês do CSS3

CSS3 é demais!
Ele vem pra ajudar a vida dos desenvolvedores e enriquecer as aplicações web com detalhes que podem enriquecer a experiência do usuário. Nessa talk abordamos um pouco sobre porque CSS3 é tão legal além de adentrar em alguns paranuês da linguagem, mostrando sintaxe, exemplos, snippets e pegadinhas.

Raphael Fabeni

October 25, 2014
Tweet

More Decks by Raphael Fabeni

Other Decks in Technology

Transcript

  1. Design não é apenas o que parece e o que

    se sente. Design é como funciona! Steve Jobs
  2. “…preprocessors can be fantastic tools in the right hands. Tread

    carefully. In my experience, the longer you use them, the less useful they become. More than anything, it depends.” Daniel Eden
  3. “Pré processadores podem ajudar como também podem maltratar bastante. Basta

    um escorregão para que seu projeto vire um inferno.” Diego Eis
  4. 9.0 4.0 3.1 10.5 3.5 3.2 mini ... 2.1 7.0

    11.5 Suporte transform 37 32 10 9.9
  5. Translate transform: translate(value, value); // X e Y transform: translateX(value);

    // X transform: translateY(value); // Y .class { transform: translateX(50px); } .class { transform: translate(50px, 25px); } transform
  6. Mixins transform @mixin transform($parameters) { -webkit-transform: $parameters; -moz-transform: $parameters; -o-transform:

    $parameters; -ms-transform: $parameters; transform: $parameters; } @mixin origin($valueX, $valueY) { -webkit-transform-origin: $valueX $valueY; -moz-transform-origin: $valueX $valueY; -o-transform-origin: $valueX $valueY; -ms-transform-origin: $valueX $valueY; transform-origin: $valueX $valueY; }
  7. transform @mixin perspective($value) { -webkit-perspective: $value; -moz-perspective: $value; -o-perspective: $value;

    -ms-perspective: $value; perspective: $value; } @mixin transform-style($value) { -webkit-transform-style: $value; -moz-transform-style: $value; -o-transform-style: $value; -ms-transform-style: $value; transform-style: $value; } @mixin backface-visibility($value) { -webkit-backface-visibility: $value; -moz-backface-visibility: $value; -o-backface-visibility: $value; -ms-backface-visibility: $value; backface-visibility: $value; }
  8. Prefixos Sintaxe -webkit-transition: paranaues; -moz-transition: paranaues; -o-transition: paranaues; transition: paranaues;

    *transition-property: property; *transition-duration: duration; transition-timing-function: value; transition-delay: delay; transition: property duration timing-function delay; transition
  9. Sintaxe transition property* duration* timing- function delay property duration ease

    0 ease-in time ease-out cubic-bezier steps transition: background-color 1s; transition: background-color 1s ease 0;
  10. transition Transition (display) .class { opacity: 1; height: 400px; transition:

    height 0, opacity 0.5s; } .class:hover { opacity: 0; height: 0; transition: opacity 0.5s, height 0 0.5s; }
  11. transition Transition (accordion) .class { display: none; transition: display .5s;

    } .class.active { display: block; } bit.ly/transition-accordion
  12. transition Transition (accordion) .class { opacity: 0; max-height: 0; overflow:

    hidden; transition: all 1s; } .class.active { opacity: 1; max-height: 500px; } bit.ly/transition-accordion
  13. transition Transition (accordion) .class { opacity: 0; max-height: 0; overflow:

    hidden; transform: translateX(150px); transition: all 1s; } .class.active { opacity: 1; max-height: 500px; transform: translateX(0); } bit.ly/transition-accordion
  14. transition Mixin @mixin transition($parameters...) { -webkit-transition: $parameters; -moz-transition: $parameters; -o-transition:

    $parameters; transition: $parameters; } .class { @include transition(background-color 1s ease); }
  15. Prefixos Keyframes animation @-webkit-keyframes animacao {...} @-moz-keyframes animacao {...} @-o-keyframes

    animacao {...} @keyframes animacao {...} @keyframes animacao { from { ... } to { ... } }
  16. Keyframes transition @keyframes inferno { from { ... } to

    { ... } } @keyframes inferno { 0% { ... } 50% { ... } 100% { ... } }  forma mais básica  2 passos  maior controle  relativa à duração
  17. Sintaxe animation *animation-name: name; *animation-duration: duration; animation-timing-function: value; animation-delay: delay;

    animation-iteration-count: value; animation-direction: value; animation-fill-mode: value; animation-play-state: value; animation: name duration timing-function delay iteration-count direction fill-mode play-state;
  18. animation name* duration* timing- function delay iteration -count direction fill-mode

    play- state name duration ease 0 1 normal none runnin g ease-in time infinite alternate forwards paused ease-out value reverse backwards cubic- bezier alternate -reverse both steps Sintaxe
  19. animation .class { animation: inferno 1s; } @keyframes inferno {

    from { background-color: #fff; height: 400px; } to { background-color: #eee; height: 200px; } }
  20. animation .class { animation: inferno 1s; } animation-name: inferno; animation-duration:

    1s; animation-timing-function: ease; animation-delay: 0; animation-iteration-count: 1; animation-direction: normal; animation-fill-mode: none; animation-play-state: running;
  21. animation .class { animation: inferno 1s; } animation-name: inferno; animation-duration:

    1s; animation-timing-function: ease; animation-delay: 0; animation-iteration-count: 1; animation-direction: normal; animation-fill-mode: none; animation-play-state: running; .class { animation: inferno 1s ease 0 1 normal none running; }
  22. timing function animation animation: inferno 1.5s linear; bit.ly/animation-timing-function animation: inferno

    1.5s ease; animation: inferno 1.5s ease-in; animation: inferno 1.5s ease-out; animation: inferno 1.5s cubic-bezier(0.680, -.550. 0.265, 1.550); animation: inferno 1.5s steps(4, end);
  23. animation bit.ly/animation-direction direction animation: inferno 1.5s; animation: inferno 1.5s reverse;

    animation: inferno 1.5s alternate; animation: inferno 1.5s alternate-reverse;
  24. animation bit.ly/animation-fill-mode fill mode animation: inferno 1.5s; animation: inferno 1.5s

    backwards; animation: inferno 1.5s forwards; animation: inferno 1.5s both;
  25. animation fill mode @keyframes inferno-fill { from { top: 0;

    background-color: green; } to { top: 400px; background-color: darkgreen; } } .class { background-color: orange; position: relative; top: 0; width: 200px; height: 200px; }