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

css { styles: oh-yeah; size: extended; }

css { styles: oh-yeah; size: extended; }

Presented at Encontro Anual de TI - Frederico Westphalen, RS - Brazil

CSS é uma linguagem declarativa extremamente permissiva e democrática. Ela dificilmente joga exceções, e permite que um iniciante crie coisas desde os primeiros passos. Mas isso não quer dizer que CSS seja fácil, muito menos que não existem boas práticas. Nesta talk, vamos aprender boas práticas, features pouco usadas que poderiam poupar algum trabalho e até alguns hacks

Átila Fassina

November 13, 2014
Tweet

More Decks by Átila Fassina

Other Decks in Technology

Transcript

  1. <nav class=”my-block”> <ul> <li> <span>...</span> </li> </ul> </nav> nav.my-block ul

    li span { /* my styles */ } Pega todos span no DOM Pega todos li contendo span Pega todos ul contendo li Pega todos .my-block contendo ul Pega todos .my-block que são nav Renderiza os estilos \o/
  2. <nav class=”my-block”> <ul> <li> <span>...</span> </li> </ul> </nav> .my-block span

    { /* my styles */ } Pega todos span no DOM Pega todos .my-block contendo span Renderiza os estilos \o/
  3. :pseudo-classes informações fora do documento http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#pseudo-classes :hover :active :focus :visited

    :link :target :lang() :not() :root :checked :nth-child() :first-child :last-child :last-of-type :first-of-type
  4. ::pseudo-elements abstrações além da linguagem do documento conteúdo não existe

    na source do documento http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#pseudo-elements ::first-line ::first-letter ::before ::after
  5. border-radius: x1 x2 x3 x4 / y1 y2 y3 y4

    x4 y4 x1 y1 x2 y2 y3 x3 Se não houver / o valor de y é 1
  6. .woff2 ✓ 4.4* .woff ✓ ✓ 9+ ✓ ✓ ✓

    4.4 .ttf/.otf ✓ ✓ ✓ ✓ ✓ ✓ .eot 6-8 .svg ✓ ✓ ✓ 3.x
  7. @font-face { font-family: 'Ubuntu'; src: url($font-url + 'ubuntu/ubuntu-normal.woff2') format('woff2'), url($font-url

    + 'ubuntu/ubuntu-normal.woff') format('woff'); font-weight: normal; font-style: normal; }
  8. .woff2 ✓ 4.4* .woff ✓ ✓ 9+ ✓ ✓ ✓

    4.4 .ttf/.otf ✓ ✓ ✓ ✓ ✓ ✓ .eot 6-8 .svg ✓ ✓ ✓ 3.x
  9. @font-face { font-family: 'Ubuntu'; src: url($font-url + 'ubuntu/ubuntu-normal.woff2') format('woff2'), url($font-url

    + 'ubuntu/ubuntu-normal.woff') format('woff'), url($font-url + 'ubuntu/ubuntu-normal.eot) format(eot), url($font-url + 'ubuntu/ubuntu-normal.svg) format(svg); font-weight: normal; font-style: normal; }
  10. -