css pra gente grande

164
CSS pra gente grande

Upload: shankar-cabus

Post on 27-Nov-2014

343 views

Category:

Technology


3 download

DESCRIPTION

Sabemos que atualmente não é mais o sobrinho do tio da mãe do periquito azul que faz o CSS. E com projetos cada vez maiores e colaborativos, manter e escalar seu CSS é uma missão cada dia mais difícil. Mas não impossível! Aprenda com a experiência de quem já sofreu e tenha disciplina pra aprender e aplicar as melhores práticas pra organizar, reaproveitar e deixar seu CSS legível! Sem bala de prata, mas com chibatada!!!

TRANSCRIPT

Page 1: CSS Pra Gente Grande

CSSpra gente grande

Page 2: CSS Pra Gente Grande

www.shankarcabus.com.br

Shankar Cabus

Page 3: CSS Pra Gente Grande

www.shankarcabus.com.br

Shankar Cabusde Teive

Page 4: CSS Pra Gente Grande

www.shankarcabus.com.br

Shankar Cabusde Teive e Argollo

Page 5: CSS Pra Gente Grande

JusBrasil

Page 6: CSS Pra Gente Grande

JusBrasil

Page 7: CSS Pra Gente Grande

css

Page 8: CSS Pra Gente Grande

CSSpra gente

pequena

Sobrinho

Page 9: CSS Pra Gente Grande
Page 10: CSS Pra Gente Grande
Page 11: CSS Pra Gente Grande

HTML

JAVASCRIPT

CSS

Page 12: CSS Pra Gente Grande

HTML

JAVASCRIPT

CSS

informação e estrutura

Page 13: CSS Pra Gente Grande

HTML

JAVASCRIPT

CSS

informação e estrutura

ação e comportamento

Page 14: CSS Pra Gente Grande

HTML

JAVASCRIPT

CSS

informação e estrutura

ação e comportamento

estilo e formatação

Page 15: CSS Pra Gente Grande
Page 16: CSS Pra Gente Grande
Page 17: CSS Pra Gente Grande
Page 18: CSS Pra Gente Grande

CSS embeleza e

facilita o uso

Page 19: CSS Pra Gente Grande
Page 20: CSS Pra Gente Grande

CSS é simples

Page 21: CSS Pra Gente Grande

CSS é simplesde entender!

Page 22: CSS Pra Gente Grande

CSS é simplesde entender!mas difícil de

usar e manter!

Page 23: CSS Pra Gente Grande
Page 24: CSS Pra Gente Grande
Page 25: CSS Pra Gente Grande

TUNEL DO

TEMPO

Page 26: CSS Pra Gente Grande

TUNEL DO

TEMPO

Page 27: CSS Pra Gente Grande

2014

Page 28: CSS Pra Gente Grande

65000000 a.c.

DINOSSÁUROS

Page 29: CSS Pra Gente Grande

17-02-1987

Page 30: CSS Pra Gente Grande

17-02-1987

Shankarzinho

Page 31: CSS Pra Gente Grande

17-02-1987

Shankarzinho Isinha

Page 32: CSS Pra Gente Grande

1988

Page 33: CSS Pra Gente Grande

1989

Page 34: CSS Pra Gente Grande

1989

Tim Berners-Lee

Page 35: CSS Pra Gente Grande

1989

Tim Berners-Lee

Web

Page 36: CSS Pra Gente Grande

1990

Tim Berners-Lee

Page 37: CSS Pra Gente Grande

1990

HTML

Tim Berners-Lee

Page 38: CSS Pra Gente Grande

1991

HTML 1.0

Page 39: CSS Pra Gente Grande

1994

Page 40: CSS Pra Gente Grande

1994

Seleção Brasileira

Page 41: CSS Pra Gente Grande

1994

Seleção Brasileira

Tetra!!!

Page 42: CSS Pra Gente Grande

1994

HTML 2.0imagens

Page 43: CSS Pra Gente Grande

1994

Håkon Lie

Page 44: CSS Pra Gente Grande

1994

Håkon Lie

CSS

Page 45: CSS Pra Gente Grande

1995

HTML 3.0tabelas

Page 46: CSS Pra Gente Grande

1995

HTML 3.0tabelas

IE 1

Page 47: CSS Pra Gente Grande

1996

CSS 1.0

Page 48: CSS Pra Gente Grande

1996

CSS 1.0

IE 3

Page 49: CSS Pra Gente Grande

1997

HTML 3.5

Page 50: CSS Pra Gente Grande

1997

HTML 3.5

IE 4

Page 51: CSS Pra Gente Grande

1999

HTML 4.0

Page 52: CSS Pra Gente Grande

1999

HTML 4.0

IE 5

Page 53: CSS Pra Gente Grande

2001

IE 6

Page 54: CSS Pra Gente Grande

2004

Firefox

Page 55: CSS Pra Gente Grande

2004

Firefox

IE 6

Page 56: CSS Pra Gente Grande

2008

css 2.0

Page 57: CSS Pra Gente Grande

2008

css 2.0

Chrome

Page 58: CSS Pra Gente Grande

2010

html 5

Page 59: CSS Pra Gente Grande

2011

CSS 3.0

Page 60: CSS Pra Gente Grande

2011

CSS 3.0

IE 6

Page 61: CSS Pra Gente Grande

2014

Page 62: CSS Pra Gente Grande

linguagem retardada, armengada

e desorganizada

Page 63: CSS Pra Gente Grande

DIFÍCIL DE MANTER E ESCALAR

Page 64: CSS Pra Gente Grande

Todo CSS começa bem mas você

nunca sabe como vai terminar acabar

Page 65: CSS Pra Gente Grande

COMEÇAR E CONTINUAR

BEM

Page 66: CSS Pra Gente Grande

organizado Legível

Componentizado

CSS

Page 67: CSS Pra Gente Grande

COMO???

Page 68: CSS Pra Gente Grande

calma…

Page 69: CSS Pra Gente Grande

calma…

Page 70: CSS Pra Gente Grande

broken window

Page 71: CSS Pra Gente Grande

disciplina

Page 72: CSS Pra Gente Grande

Chibata

Page 73: CSS Pra Gente Grande

Chibata

Page 74: CSS Pra Gente Grande

ChibataLei da

Page 75: CSS Pra Gente Grande

bala de prata

Page 76: CSS Pra Gente Grande

bala de prata

SMACSS

OOCSS

BEM DRY CSS

CSS Guidelines

GitHub

CodePen

Medium

TrelloSUIT CSS

Page 77: CSS Pra Gente Grande

bala de prata

SMACSS

OOCSS

BEM DRY CSS

CSS Guidelines

GitHub

CodePen

Medium

TrelloSUIT CSS

x

Page 78: CSS Pra Gente Grande

Nome

Email

Mensagem

Enviar

<div id=“contato”>!! <input id="nome" type=“text”>! <input id="email" type=“text">! <textarea id=“mensagem"></textarea>! <button>Enviar</button>!</div>

Page 79: CSS Pra Gente Grande

Nome

Email

Mensagem

Enviar

#contact {! width: 500px;! padding: 10px;! background: #ccc;! border: 1px solid #999;! border-radius: 5px;!}!#contact input,!#contact textarea {!! width: 100%;!! border: 1px solid #999;!}!#contact button {!! float: right;!! padding: 5px;!! border-radius: 5px;!! background: green;!}

Page 80: CSS Pra Gente Grande

OK

Cuidado com os nomes

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ut sagittis diam. Ut tincidunt iaculis eleifend. Donec sed scelerisque erat?

<div id=“warning”>! <h1>Cuidado com os nomes</h1>! <p>…</p>! <button>OK</button>!</div>

Page 81: CSS Pra Gente Grande

#warning {! width: 400px;! padding: 10px;! background: #ccc;! border: 1px solid #999;! border-radius: 5px;!}!#warning h1 {!! font-size: 14px;!! font-weight: bold;!}!#warning button {!! float: right;!! padding: 5px;!! border-radius: 5px;!! background: blue;!}

OK

Cuidado com os nomes

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ut sagittis diam. Ut tincidunt iaculis eleifend. Donec sed scelerisque erat?

Page 82: CSS Pra Gente Grande

Nome

Email

Mensagem

EnviarOK

Cuidado com os nomes

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ut sagittis diam. Ut tincidunt iaculis eleifend. Donec sed scelerisque erat?

Page 83: CSS Pra Gente Grande

#contact {! width: 500px;! padding: 10px;! background: #ccc;! border: 1px solid #999;! border-radius: 5px;!}!#contact input, !#contact textarea {!! width: 100%;!! border: 1px solid #999;!}!#contact button {!! float: right;!! padding: 5px;!! border-radius: 5px;!! background: green;!}

#warning {! width: 400px;! padding: 10px;! background: #ccc;! border: 1px solid #999;! border-radius: 5px;!}!#warning h1 {!! font-size: 14px;!! font-weight: bold;!}!#warning button {!! float: right;!! padding: 5px;!! border-radius: 5px;!! background: blue;!}

Page 84: CSS Pra Gente Grande

.box {! padding: 10px;! background: #ccc;! border: 1px solid #999;! border-radius: 5px;!}!!.button {! float: right;! padding: 5px;! border-radius: 5px;!}

#warning {! width: 400px;!}!#warning h1 {! font-size: 14px;! font-weight: bold;!}!#warning button {! background: blue;!}!!#contact {! width: 500px;!}!#contact input, !#contact textarea {! width: 100%;! border: 1px solid #999;!}!#contact button {! background: green;!}

Page 85: CSS Pra Gente Grande

<div id="contact" class=“box”>!! <input id="nome" type=“text”>! <input id="email" type=“text">! <textarea id=“mensagem"></textarea>! <button class="button">Enviar</button>!</div>

<div id="warning" class=“box”>! <h1>Cuidado com os nomes</h1>! <p>…</p>! <button class="button">OK</button>!</div>

Page 86: CSS Pra Gente Grande

.box {! padding: 10px;! background: #ccc;! border: 1px solid #999;! border-radius: 5px;!}!!.button {! float: right;! padding: 5px;! border-radius: 5px;!}

#warning {! width: 400px;!}!#warning h1 {! font-size: 14px;! font-weight: bold;!}!#warning button {! background: blue;!}!!#contact {! width: 500px;!}!#contact input, !#contact textarea {! width: 100%;! border: 1px solid #999;!}!#contact button {! background: green;!}

Page 87: CSS Pra Gente Grande
Page 88: CSS Pra Gente Grande
Page 89: CSS Pra Gente Grande
Page 90: CSS Pra Gente Grande

Definindo Padrões e regras

Dona Norma

Page 91: CSS Pra Gente Grande

.foo, .bar!{! padding:15px;! margin:0px 0px 15px;! box-shadow:0px 1px 2px #CCC;! background: #DDDDDD;!}

Page 92: CSS Pra Gente Grande

.foo, .bar!{! padding:15px;! margin:0px 0px 15px;! box-shadow:0px 1px 2px #CCC;! background: #DDDDDD;!}

.foo, !

.bar {! padding: 15px;! margin-bottom: 15px;! box-shadow: 0 1px 2px #ccc;! background: #ddd;!}

Page 93: CSS Pra Gente Grande

use reset

Page 94: CSS Pra Gente Grande

nunca use !important

Page 95: CSS Pra Gente Grande

nunca use #id {…}

Page 96: CSS Pra Gente Grande

não use element {…}

Page 97: CSS Pra Gente Grande

cuidado com classes utilitárias

Page 98: CSS Pra Gente Grande

.clear-float { clear: both; }

Page 99: CSS Pra Gente Grande

.clear-float { clear: both; }

.is-hide { display: none; }

Page 100: CSS Pra Gente Grande

.clear-float { clear: both; }

.float-left { float: left; }!

.mt-20 { margin-top: 20px; }

.is-hide { display: none; }

Page 101: CSS Pra Gente Grande

.clear-float { clear: both; }

<div class=“float-left">

<div style=“float: left”>

.float-left { float: left; }!

.mt-20 { margin-top: 20px; }

.is-hide { display: none; }

Page 102: CSS Pra Gente Grande

Preprocessor

Pedindo Ajuda

Page 103: CSS Pra Gente Grande

.bar {! color: #bada55;! background: #f00;! border: #bada55;!}

Page 104: CSS Pra Gente Grande

.bar {! color: #bada55;! background: #f00;! border: #bada55;!}

@my-green: #bada55;!@my-red: #f00;!!.bar {! color: @my-green;! background: @my-red;! border: @my-green;!}

Page 105: CSS Pra Gente Grande

Modularize

Page 106: CSS Pra Gente Grande

// General Dependencies!@import "mixins";!@import "variables";!!// Base!@import "reset";!@import "layout";!!// Components!@import "typography";!@import "forms";!@import "toolbox";!@import "buttons";!@import "modals";!@import "messages";!@import “badges";!!// Areas!@import "header";!@import "footer";

Page 107: CSS Pra Gente Grande

Use espaço

e identação

Page 108: CSS Pra Gente Grande

.foo {!width: 20px;!height: 150px;!} !.foo .inner-foo {!width: 10px;!height: 10px;!} !.bar {!width: 5px;!height: 5px;!border-radius: 50%;!} !.bar .foo {!background: blue;!}

Page 109: CSS Pra Gente Grande

.foo {!width: 20px;!height: 150px;!} !.foo .inner-foo {!width: 10px;!height: 10px;!} !.bar {!width: 5px;!height: 5px;!border-radius: 50%;!} !.bar .foo {!background: blue;!}

.foo {! width: 20px;! height: 150px;!}!! .foo .inner-foo {! width: 10px;! height: 10px;! }!!!.bar {! width: 5px;! height: 5px;! border-radius: 50%;!}!! .bar .foo {! background: blue;! }

Page 110: CSS Pra Gente Grande

.foo {!width: 20px;!height: 150px;!} !.foo .inner-foo {!width: 10px;!height: 10px;!} !.bar {!width: 5px;!height: 5px;!border-radius: 50%;!} !.bar .foo {!background: blue;!}

.foo {! width: 20px;! height: 150px;!}!! .foo .inner-foo {! width: 10px;! height: 10px;! }!!!.bar {! width: 5px;! height: 5px;! border-radius: 50%;!}!! .bar .foo {! background: blue;! }

Page 111: CSS Pra Gente Grande

.foo {!width: 20px;!height: 150px;!} !.foo .inner-foo {!width: 10px;!height: 10px;!} !.bar {!width: 5px;!height: 5px;!border-radius: 50%;!} !.bar .foo {!background: blue;!}

.foo {! width: 20px;! height: 150px;!}!! .foo .inner-foo {! width: 10px;! height: 10px;! }!!!.bar {! width: 5px;! height: 5px;! border-radius: 50%;!}!! .bar .foo {! background: blue;! }

Page 112: CSS Pra Gente Grande

.foo {!width: 20px;!height: 150px;!} !.foo .inner-foo {!width: 10px;!height: 10px;!} !.bar {!width: 5px;!height: 5px;!border-radius: 50%;!} !.bar .foo {!background: blue;!}

.foo {! width: 20px;! height: 150px;!}!! .foo .inner-foo {! width: 10px;! height: 10px;! }!!!.bar {! width: 5px;! height: 5px;! border-radius: 50%;!}!! .bar .foo {! background: blue;! }

Page 113: CSS Pra Gente Grande

<div class=“foo inner-foo box box-highlight“>

Page 114: CSS Pra Gente Grande

<div class=“foo inner-foo box box-highlight“>

<div class=“foo inner-foo box box-highlight“>

<div class=“[ foo inner-foo ] [ box box-highlight ]“>

Page 115: CSS Pra Gente Grande

<div class=“foo inner-foo box box-highlight“>

<div class=“foo inner-foo box box-highlight“>

<div class=“[ foo inner-foo ] [ box box-highlight ]“>

Page 116: CSS Pra Gente Grande

<div class=“foo inner-foo box box-highlight“>

<div class=“foo inner-foo box box-highlight“>

<div class=“[ foo inner-foo ] [ box box-highlight ]“>

Page 117: CSS Pra Gente Grande

Comente

Page 118: CSS Pra Gente Grande

/**! * The site’s main page-head can have two different states:! *! * 1) Regular page-head with no backgrounds or extra treatments; it just! * contains the logo and nav.! * 2) A masthead that has a fluid-height (becoming fixed after a certain point)! * which has a large background image, and some supporting text.! *! * The regular page-head is incredibly simple, but the masthead version has some! * slightly intermingled dependency with the wrapper that lives inside it.! */

Page 119: CSS Pra Gente Grande

/**! * 1. Default icon size is 16px.! * 2. Squash down the retina sprite to display ! * at the correct size.! */!!.sprite {! width: 16px; /* [@1x] */! height: 16px; /* [@1x] */! background-image: url(/img/sprites/main.png);!}

Page 120: CSS Pra Gente Grande

Dando um nome pro seu filho

Tia Jamile

Page 121: CSS Pra Gente Grande
Page 122: CSS Pra Gente Grande

.componentName

Page 123: CSS Pra Gente Grande

.componentName

.guardaRoupa

Page 124: CSS Pra Gente Grande

.componentName

.componentName-member

.guardaRoupa

Page 125: CSS Pra Gente Grande

.componentName

.componentName-member

.guardaRoupa

.guardaRoupa-gaveta

Page 126: CSS Pra Gente Grande

.componentName

.componentName-member

.guardaRoupa

.guardaRoupa-gaveta

.guardaRoupa-gaveta-puxador

Page 127: CSS Pra Gente Grande

.componentName

.componentName-member

.componentName-member--modifier

.guardaRoupa

.guardaRoupa-gaveta

.guardaRoupa-gaveta-puxador

Page 128: CSS Pra Gente Grande

.componentName

.componentName-member

.componentName-member--modifier

.guardaRoupa

.guardaRoupa-gaveta

.guardaRoupa-gaveta--aberta

.guardaRoupa-gaveta-puxador

Page 129: CSS Pra Gente Grande
Page 130: CSS Pra Gente Grande

.baby {! width: 20px;! height: 150px;! background: white;!}

Page 131: CSS Pra Gente Grande

.baby {! width: 20px;! height: 150px;! background: white;!}

.baby-head {!! width: 10px;!! height: 10px;! }

Page 132: CSS Pra Gente Grande

.baby {! width: 20px;! height: 150px;! background: white;!}

.baby-head {!! width: 10px;!! height: 10px;! }

.baby-head-eyes {!! width: 5px;!! height: 5px;!! border-radius: 50%;! background: brown;! }

Page 133: CSS Pra Gente Grande

.baby {! width: 20px;! height: 150px;! background: white;!}

.baby-head {!! width: 10px;!! height: 10px;! }

.baby-head-eyes {!! width: 5px;!! height: 5px;!! border-radius: 50%;! background: brown;! }

.baby-head-eyes--blue {!! ! background: blue;! }

Page 134: CSS Pra Gente Grande

<div class=“baby”>! <div class=“baby-head”>! <div class=“baby-head-eyes baby-head-eyes--blue”>! </div>!</div>

Page 135: CSS Pra Gente Grande
Page 136: CSS Pra Gente Grande
Page 137: CSS Pra Gente Grande

.button {!! padding: 10px 20px;!! border-radius: 3px;!! background: #757575;!! color: #fff;!! font-size: 13px;!}

Page 138: CSS Pra Gente Grande

.button {!! padding: 10px 20px;!! border-radius: 3px;!! background: #757575;!! color: #fff;!! font-size: 13px;!}

Page 139: CSS Pra Gente Grande

.button {!! padding: 10px 20px;!! border-radius: 3px;!! background: #757575;!! color: #fff;!! font-size: 13px;!}

.button--big {!! padding: 15px 25px;!! font-size: 15px;!}

Page 140: CSS Pra Gente Grande

.button {!! padding: 10px 20px;!! border-radius: 3px;!! background: #757575;!! color: #fff;!! font-size: 13px;!}

.button--big {!! padding: 15px 25px;!! font-size: 15px;!}

.button--small {!! padding: 5px 10px;!! font-size: 11px;!}

Page 141: CSS Pra Gente Grande

.button {!! padding: 10px 20px;!! border-radius: 3px;!! background: #757575;!! color: #fff;!! font-size: 13px;!}

.button--big {!! padding: 15px 25px;!! font-size: 15px;!}

.button--small {!! padding: 5px 10px;!! font-size: 11px;!}

.button--blue {!! background: #008fed;!}!.button--green {!! background: #79b439;!}!.button--yellow {!! background: #ffb400;!}!.button--orange {!! background: #fe8b00;!}!.button--red {!! background: #ff5604;!}

Page 142: CSS Pra Gente Grande

button--big

button--small

button--blue

button--green

button--yellow

button--orange

button--red

button

Page 143: CSS Pra Gente Grande
Page 144: CSS Pra Gente Grande

class=“button button--big button--blue“

Page 145: CSS Pra Gente Grande

class=“button button--big button--blue“

Page 146: CSS Pra Gente Grande
Page 147: CSS Pra Gente Grande
Page 148: CSS Pra Gente Grande

.dropdown {!! padding-right: 50px;!! &:after {!! ! content: " ";!! }!}

^

Page 149: CSS Pra Gente Grande

.dropdown {!! padding-right: 50px;!! &:after {!! ! content: " ";!! }!}

^.button {!! padding: 10px 20px;!! border-radius: 3px;!! background: #757575;!! color: #fff;!! font-size: 13px;!}

Page 150: CSS Pra Gente Grande

.button, .dropdown {!! padding: 10px 20px;!! border-radius: 3px;!! background: #757575;!! color: #fff;!! font-size: 13px;!}

.dropdown {!! padding-right: 50px;!! &:after {!! ! content: " ";!! }!}

^

Page 151: CSS Pra Gente Grande

Manutenível

Page 152: CSS Pra Gente Grande

Escalável

Manutenível

Page 153: CSS Pra Gente Grande

Escalável

Organizado

Manutenível

Page 154: CSS Pra Gente Grande

Escalável

OrganizadoLegível

Manutenível

Page 155: CSS Pra Gente Grande

Escalável

Reaproveitável

OrganizadoLegível

Manutenível

Page 156: CSS Pra Gente Grande

Escalável

Reaproveitável

OrganizadoLegível

Manutenível

ModularizadoPadronizado

Page 157: CSS Pra Gente Grande

Escalável

Reaproveitável

OrganizadoLegível

Manutenível

ModularizadoPadronizado

EspaçadoIdentadoComentado

Page 158: CSS Pra Gente Grande

Escalável

Reaproveitável

OrganizadoLegível

Manutenível

ModularizadoPadronizado

EspaçadoIdentadoComentado

Componentizado

Page 159: CSS Pra Gente Grande

Não quebre janela

Page 160: CSS Pra Gente Grande

Disciplina

Page 161: CSS Pra Gente Grande
Page 162: CSS Pra Gente Grande

Chibaaaaaaaaata!!

Page 163: CSS Pra Gente Grande

Obrigado!shankarcabus.com.br

Page 164: CSS Pra Gente Grande

_github.com/shankarcabus/scalable-css-reading-list