h o w t o b e s t y l i s h a n d s t a y s a n e
HOW TO MAKE YOUR CSS
!
NOT SUCK
Rouan Wilsenach
@rouanw
Socrates Hlapolosa
shlapol@thoughtworks.com
2
“CSS sucks. I just want to write code.”
A lonely developer, after finally getting that
margin-right right
3
Treat CSS like code
Think about your styles
like a consumer
CSS SMELLS
4
5
Whoa! That’s a lot of CSS.
6
Writing a lot of CSS for each feature
7
No reuse
8
Everything is special
9
Duplicate CSS
10
Side effects
COMPONENT-BASED
!
STYLING
Principles
11
12
13
Pick a component
Include CSS
Use markup structure
Add classes
14
Create your own style guide
15
Living documentation
16
Re-use Consistency
17
18
19
Component shopping
20
Component shopkeeping
HOW TO
CSS Tips & Practices
21
23
Style each component once
24
Consistent markup
25Scope specific styles
26
Is this a new component?
27
Be critical of every line
28
Talk about it and keep things simple
29
Mobile first
RECAP
Again! Again!
30
31
Treat CSS like code
Critical of every line
Don’t write CSS
Scope specific CSS
Consistent markup
32
Think about your styles
like a consumer
Style once, re-use
Keep it simple
Component shopkeeping
SOME RESOURCES
Simple style guide demo
•https://github.com/rouanw/style-guide-demo
!
Other example style guides
•Lonely planet style guide
•Atom text editor
!
Unwind with some amazing CSS puns
•http://www.hongkiat.com/blog/funny-css-puns/
33
h o w t o b e s t y l i s h a n d s t a y s a n e
HOW TO MAKE YOUR CSS
!
NOT SUCK
Rouan Wilsenach
@rouanw
Socrates Hlapolosa
shlapol@thoughtworks.com

How to make your css not suck