Gregory Van Looy / Fronteers meetup — 22/05/2014
Freelance HTML & CSS architect/consultant @ diezjietal
I suck @ JavaScript
Lorem ipsum dolor sit amet.
* Any resemblance to a real CMS is purely coincidental.
header nav#main-nav > ul.nav li ul li {}
CSS wasn't totally neglected.
People started bulletproofing, handcrafting and hardboiling CSS.
Every site gets bigger.
To: Gregory Van Looy
From: some@designer.com
Subject: Designs
Hi Greg,
I've attached the design to this email.
Good luck,
some designer
attachment: home-final-v2-update.jpg
To: Gregory Van Looy
From: some@designer.com
Subject: Styleguide
Hi Greg,
This is the styleguide:
Have fun,
some designer
attachment: design-styleguide.psd
To: Gregory Van Looy
From: crazy@designer.com
Subject: Styleguide
Hi Greg,
This is the styleguide:
Have fun,
a crazy designer
attachment: Book-A-general-components.pdf
attachment: Book-B-mobile-styleguide.pdf
attachment: Book-C-desktop-styleguide.pdf
ul {
margin-bottom: 24px;
}
p {
margin: 18px 0;
}
h2 {
margin-bottom: 20px;
}
ul, h2 {
margin-bottom: 20px;
}
p {
margin: 20px 0;
}
/* Sass */
$base-spacing-unit: 20px;
ul, h2 {
margin-bottom: $base-spacing-unit;
}
p {
margin: $base-spacing-unit 0;
}
p {
font-size: 16px;
}
figcaption {
font-size: 15px;
}
h6 {
font-size: 17px;
}
p,
figcaption,
h6 {
font-size: 16px;
}
/* Sass */
$base-font-size: 16px;
p,
figcaption,
h6 {
font-size: $base-font-size;
}
© Harry Roberts
.article-teaser {}
.carousel {}
.tabs {}
.tag {}
.more-link {}
.icon {}
Scalable and Modular Architecture for CSS
/* no classes here, only element selectors */
body {}
p {}
a {}
/* grid */
.col {}
.col--2 {}
.col--primary {}
/* layout specific: .layout-- prefix */
.layout--homepage {}
.layout--XXXX
classes are added to the html
tag
Biggest chunk of your CSS file
/* skip the prefix, it's too verbose */
.module-carousel {}
/* that's the way, uhu uhu */
.carousel {}
/* .is- prefix */
.is-active {}
.is-hidden {}
.is-collapsed {}
.is-expanded {}
JavaScript: easier to debug
/* .js-is- prefix */
.js-is-active {}
.js-is-hidden {}
.js-is-collapsed {}
.js-is-expanded {}
Will you need this one?
.theme--culture .article {}
.theme--x-mas blockquote:before {
content: 'hohoho';
}
.theme--
classes are added to the html
tag
in combination with Sass
| - sass
|- base
_base.scss
_normalize.scss
_defaults.scss
_webfonts.scss
...
|- layout
_layout.scss
_grid.scss
_sections.scss
...
|- modules
_modules.scss
_carousel.scss
_pagination.scss
...
|- state
_state.scss
...
|- theme
_theme.scss
_x-mas.scss
...
_site-settings.scss
_mixins.scss
main.scss
Block - Element - Modifier
.block {}
.block__element {} /* note: double underscore */
.block--modifier {} /* note: double hyphen */
header nav#main-nav > ul.nav li ul li {}
...
...
...
...
/* Bad */
.pageHeader {}
.button--blue {}
/* Good */
.page-header {}
.button--primary {}
/* This is OK! */
.article__header--no-border {}
.teaser--large--primary {}
/* old skool */
article > header {}
/* old skool + Smacss theming */
.theme--x-mas article > header {}
/* BEM */
.article__header {}
/* BEM + SMACSS theming */
.theme--x-mas .article__header {}