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

Robin Pokorny
Robin PokornySoftware Engineer at Klarna
@ROBINPOKORNY
BEAUTY
Future-Ready
into a
Ugly Old
How to Turn Your
CSS
Clean
$ git clone git@ :
Homepage
http://localhost:9001/home
Homepage
http://localhost:9001/home
Developer Tools
base.css:9
float: 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>
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%
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%
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%
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%
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
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
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
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
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
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
2013
2005
1996
How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
You do not
write CSS
for
yourself.
How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
index.html 1,1
HTML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1.css 1,1
CSS 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2.css 1,1
CSS 2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
3.css 1,1
CSS 3
.intro div:nth-child(2) p:last-child
.sidebar .wrapper .design nav
paint out
Cascade makes it
a page.
easy
to
How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
How to Turn Your Ugly Old CSS into a Clean Future-Ready Beauty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
index.html 1,1
CSS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1.css 1,1
HTML 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2.css 1,1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
3.css 1,1
HTML 2
HTML 3
.sidebar .wrapper .design nav
btn btn-primary btn-lg
<div class="
…
</div>
">
CSS is a
pattern book
not a
crayon set.
OOCSS
@stubbornella
// 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
9
10
11
12
13
14
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
9
10
11
12
13
14
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
9
10
11
12
13
14
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
9
10
11
12
13
14
base.css 1,1
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
NOW
FUTURE
CODEBASE
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
NOW
FUTURE
CODEBASE
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
NOW
FUTURE
CODEBASE
abcdefghijklmnopqrstuvwxyz IN 1 MIN
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
NOW
FUTURE
CODEBASE
It is OK not to be
perfect.
Criticism
good.is
~ @OliverJAsh
$ exit
User @robinpokorny <robin@medvedi.eu>
is now logged out.
Use utility hand to raise a question.
1 of 47

Recommended

CSS 101 by
CSS 101CSS 101
CSS 101Sofish Lin
2.2K views102 slides
メンテナブルでありつづけるためのCSS設計 by
メンテナブルでありつづけるためのCSS設計メンテナブルでありつづけるためのCSS設計
メンテナブルでありつづけるためのCSS設計拓樹 谷
37.1K views102 slides
box model by
box modelbox model
box modeljay li
1.1K views51 slides
CSS Components by
CSS ComponentsCSS Components
CSS Components拓樹 谷
3.4K views114 slides
Thinking about CSS Architecture by
Thinking about CSS ArchitectureThinking about CSS Architecture
Thinking about CSS Architecture拓樹 谷
21.1K views136 slides
10. add in Symfony 4 by
10. add in Symfony 410. add in Symfony 4
10. add in Symfony 4Razvan Raducanu, PhD
17 views7 slides

More Related Content

What's hot

Novedades de Front-end 2016 (CSS3, HTML5 y APIs Javascript) by
Novedades de Front-end 2016 (CSS3, HTML5 y APIs Javascript)Novedades de Front-end 2016 (CSS3, HTML5 y APIs Javascript)
Novedades de Front-end 2016 (CSS3, HTML5 y APIs Javascript)Román Hernández
567 views73 slides
Middleman 一小時完成你的專案原形 by
Middleman 一小時完成你的專案原形Middleman 一小時完成你的專案原形
Middleman 一小時完成你的專案原形Even Wu
6.3K views39 slides
thiết kế website bằng blogspot by
thiết kế website bằng blogspotthiết kế website bằng blogspot
thiết kế website bằng blogspotLàm seo blogspot miễn phí
190 views87 slides
Johny see book update by
Johny see book updateJohny see book update
Johny see book updateAhmad Syaifudin
732 views32 slides
Xml version pakfaizal dot com free download by
Xml version pakfaizal dot com free downloadXml version pakfaizal dot com free download
Xml version pakfaizal dot com free downloadFaisal Pak
990 views78 slides
Keynote Les 7 by
Keynote Les 7Keynote Les 7
Keynote Les 7hba.ict
364 views29 slides

What's hot(6)

Novedades de Front-end 2016 (CSS3, HTML5 y APIs Javascript) by Román Hernández
Novedades de Front-end 2016 (CSS3, HTML5 y APIs Javascript)Novedades de Front-end 2016 (CSS3, HTML5 y APIs Javascript)
Novedades de Front-end 2016 (CSS3, HTML5 y APIs Javascript)
Román Hernández567 views
Middleman 一小時完成你的專案原形 by Even Wu
Middleman 一小時完成你的專案原形Middleman 一小時完成你的專案原形
Middleman 一小時完成你的專案原形
Even Wu6.3K views
Xml version pakfaizal dot com free download by Faisal Pak
Xml version pakfaizal dot com free downloadXml version pakfaizal dot com free download
Xml version pakfaizal dot com free download
Faisal Pak990 views
Keynote Les 7 by hba.ict
Keynote Les 7Keynote Les 7
Keynote Les 7
hba.ict364 views

More from Robin Pokorny

15 months of AMP by
15 months of AMP15 months of AMP
15 months of AMPRobin Pokorny
349 views18 slides
Purifying React (with annotations) by
Purifying React (with annotations)Purifying React (with annotations)
Purifying React (with annotations)Robin Pokorny
1.6K views26 slides
React, když odezní zamilovanost by
React, když odezní zamilovanostReact, když odezní zamilovanost
React, když odezní zamilovanostRobin Pokorny
1.3K views21 slides
React a omyly jazyka CSS by
React a omyly jazyka CSSReact a omyly jazyka CSS
React a omyly jazyka CSSRobin Pokorny
1.9K views20 slides
React a CSS by
React a CSSReact a CSS
React a CSSRobin Pokorny
1.6K views23 slides
Co musí umět moderní „HTML kodér“ by
Co musí umět moderní „HTML kodér“Co musí umět moderní „HTML kodér“
Co musí umět moderní „HTML kodér“Robin Pokorny
1.2K views22 slides

More from Robin Pokorny(13)

Purifying React (with annotations) by Robin Pokorny
Purifying React (with annotations)Purifying React (with annotations)
Purifying React (with annotations)
Robin Pokorny1.6K views
React, když odezní zamilovanost by Robin Pokorny
React, když odezní zamilovanostReact, když odezní zamilovanost
React, když odezní zamilovanost
Robin Pokorny1.3K views
React a omyly jazyka CSS by Robin Pokorny
React a omyly jazyka CSSReact a omyly jazyka CSS
React a omyly jazyka CSS
Robin Pokorny1.9K views
Co musí umět moderní „HTML kodér“ by Robin Pokorny
Co musí umět moderní „HTML kodér“Co musí umět moderní „HTML kodér“
Co musí umět moderní „HTML kodér“
Robin Pokorny1.2K views
Pokročilé responzivní obrázky by Robin Pokorny
Pokročilé responzivní obrázkyPokročilé responzivní obrázky
Pokročilé responzivní obrázky
Robin Pokorny4.4K views
O elementu picture v Ostravě by Robin Pokorny
O elementu picture v OstravěO elementu picture v Ostravě
O elementu picture v Ostravě
Robin Pokorny1.2K views
Jak nám responzivní web rozbil obrázky by Robin Pokorny
Jak nám responzivní web rozbil obrázkyJak nám responzivní web rozbil obrázky
Jak nám responzivní web rozbil obrázky
Robin Pokorny4.6K views
Organizace kódu v týmu by Robin Pokorny
Organizace kódu v týmuOrganizace kódu v týmu
Organizace kódu v týmu
Robin Pokorny1.2K views
Thesis defendence presentation by Robin Pokorny
Thesis defendence presentationThesis defendence presentation
Thesis defendence presentation
Robin Pokorny375 views
Tancuj, tancuj, konverguj by Robin Pokorny
Tancuj, tancuj, konvergujTancuj, tancuj, konverguj
Tancuj, tancuj, konverguj
Robin Pokorny603 views

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