How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

47
@ROBINPOKORNY BEAUTY Future-Ready into a Ugly Old How to Turn Your CSS Clean

description

Slides from my WebExpo presentation: http://webexpo.net/prague2013/talk/how-to-turn-your-ugly-old-css-into-clean-future-ready-beauty/ I hope to add annotations soon.

Transcript of How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Page 1: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

@ROBINPOKORNY

BEAUTYFuture-Readyinto aUgly OldHow to Turn Your

CSSClean

Page 2: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

$ git clone git@ :

Page 3: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Homepage http://localhost:9001/home

Page 4: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Homepage http://localhost:9001/home

Developer Tools

base.css:9float: right; background-color: ;

<!DOCTYPE html>    <head>        <meta charset="utf-8">        <meta http-equiv="X-UA-Compatible" content="IE=edge">        <title>Homepage</title>        <meta name="description" content="Just another demo">        <meta name="viewport" content="width=device-width">        <link rel="stylesheet" href="css/normalize.css">        <link rel="stylesheet" href="css/base.css">    </head>    <body>        <h1>Hello, this is Robin’s demo site.</h1> <p>

Page 5: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Homepage http://localhost:9001/home

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-color: ; font-style: bold; border-radius: 0;

}

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 base.css 1,1 0%

Page 6: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Homepage http://localhost:9001/home

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-color: ; font-style: bold; border-radius: 0;

}

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 base.css 1,1 0%

Page 7: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Homepage http://localhost:9001/home

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-color: ; font-style: bold; border-radius: 0;

}

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 base.css 1,1 0%

Page 8: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Homepage http://localhost:9001/home

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-color: ; font-style: bold; border-radius: 0;

}

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 base.css 1,1 0%

Page 9: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Homepage http://localhost:9001/home

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-color: ; font-style: bold; border-radius: 0;

}

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 base.css 1,1 0%

About us http://localhost:9001/about-us

Blog http://localhost:9001/blog

Contacts http://localhost:9001/contacts

Page 10: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Homepage http://localhost:9001/home

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-color: ; font-style: bold; border-radius: 0;

}

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 base.css 1,1 0%

About us http://localhost:9001/about-us

Blog http://localhost:9001/blog

Contacts http://localhost:9001/contacts

Page 11: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Homepage http://localhost:9001/home

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-color: ; font-style: bold; border-radius: 0;

}

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 base.css 1,1 0%

About us http://localhost:9001/about-us

Blog http://localhost:9001/blog

Contacts http://localhost:9001/contacts

Page 12: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Homepage http://localhost:9001/home

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-color: ; font-style: bold; border-radius: 0;

}

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 base.css 1,1 0%

About us http://localhost:9001/about-us

Blog http://localhost:9001/blog

Contacts http://localhost:9001/contacts

Page 13: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Homepage http://localhost:9001/home

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-color: ; font-style: bold; border-radius: 0;

}

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 base.css 1,1 0%

About us http://localhost:9001/about-us

Blog http://localhost:9001/blog

Contacts http://localhost:9001/contacts

Page 14: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Homepage http://localhost:9001/home

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-color: ; font-style: bold; border-radius: 0;

}

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 base.css 1,1 0%

About us http://localhost:9001/about-us

Blog http://localhost:9001/blog

Contacts http://localhost:9001/contacts

Page 15: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

2013

Page 16: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

2005

Page 17: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

1996

Page 18: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
Page 19: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
Page 20: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

You do not write CSSfor

yourself.

Page 21: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
Page 22: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
Page 23: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
Page 24: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
Page 25: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

1 2 3 4 5 6 7 8 910 1112 1314 index.html 1,1

HTML

1 2 3 4 5 6 7 8 910 1112 1314 1.css 1,1

CSS 1

1 2 3 4 5 6 7 8 910 1112 1314 2.css 1,1

CSS 2

1 2 3 4 5 6 7 8 910 1112 1314 3.css 1,1

CSS 3

Page 26: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

.intro div:nth-child(2) p:last-child

Page 27: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

.sidebar .wrapper .design nav

Page 28: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

paint outCascade makes it

a page.

easyto

Page 29: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
Page 30: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
Page 31: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
Page 32: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
Page 33: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
Page 34: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
Page 35: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

1 2 3 4 5 6 7 8 910 1112 1314 index.html 1,1

CSS

1 2 3 4 5 6 7 8 910 1112 1314 1.css 1,1

HTML 1

1 2 3 4 5 6 7 8 910 1112 1314 2.css 1,1

1 2 3 4 5 6 7 8 910 1112 1314 3.css 1,1

HTML 2

HTML 3

Page 36: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

.sidebar .wrapper .design nav

Page 37: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

btn btn-primary btn-lg<div class="

…</div>

">

Page 38: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

CSS is a

pattern booknot a

crayon set.

Page 39: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

OOCSS@stubbornella

Page 40: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

// Includes layout and typography@import url('layout.less');

@import url('article.less');

@import url('navigation.less');

@import url('buttons.less');

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 base.less 1,1 0%

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-

1 2 3 4 5 6 7 8 910 1112 1314 base.css 1,1

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-

1 2 3 4 5 6 7 8 910 1112 1314 base.css 1,1

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-

1 2 3 4 5 6 7 8 910 1112 1314 base.css 1,1

#header h2.logotype { … }#header .logotype a { … }

#layout_content maincap { … }#layout_content div.maincap h1 { … }#layout_content div.maincap h1.beta { #layout_content .maincap .ghostcap

#box .banner:first-child a {float: right; background-

1 2 3 4 5 6 7 8 910 1112 1314 base.css 1,1

Page 41: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

abcdefghijklmnopqrstuvwxyz

abcdefghijklmnopqrstuvwxyz

NOW

FUTURE

CODEBASE

Page 42: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz

abcdefghijklmnopqrstuvwxyz

abcdefghijklmnopqrstuvwxyz

abcdefghijklmnopqrstuvwxyz

abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz

NOW

FUTURE

CODEBASE

Page 43: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

abcdefghijklmnopqrstuvwxyz

abcdefghijklmnopqrstuvwxyz

NOW

FUTURE

CODEBASE

abcdefghijklmnopqrstuvwxyz IN 1 MIN

Page 44: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

abcdefghijklmnopqrstuvwxyz

abcdefghijklmnopqrstuvwxyz

NOW

FUTURE

CODEBASE

Page 45: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

It is OK not to be

perfect.

Page 46: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

Criticismgood.is

~ @OliverJAsh

Page 47: How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty

$ exitUser @robinpokorny <[email protected]> is now logged out.

Use utility hand to raise a question.