Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
BEM // Get Started // SASS Guidelines
Search
Julia Rechkunova
September 10, 2016
Programming
63
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
BEM // Get Started // SASS Guidelines
Intro to BEM. SASS Guidelines.
Julia Rechkunova
September 10, 2016
Transcript
19 slides
BEM Get Started SASS Guidelines @jughosta
BEM • Block • Element • Modifier More info https://en.bem.info/methodology/
BEM // Block <section class="search"> ... </section>
BEM // Element <section class="search"> <div class="search__content"> ... </div> ...
</section>
BEM // Element <section class="search"> <div class="search__content"> ... </div> <input
type="text" class="search__input"> </section>
BEM // Element <section class="search"> <div class="search__content"> <input type="text" class="?">
</div> ... </section>
BEM // Element <section class="search"> <div class="search__content"> <input type="text" class="search__input">
</div> ... </section>
BEM // Block inside Element <section class="search"> <div class="search__content"> <input
type="text" class="search__input"> <button class="button">Search</button> </div> ... </section>
BEM // Element for additional styles (margins, ...) <section class="search">
<div class="search__content"> <input type="text" class="search__input"> <button class="button" style="margin-left: 30px">Search</button> </div> ... </section>
BEM // Element for additional styles (margins, ...) <section class="search">
<div class="search__content"> <input type="text" class="search__input"> <div class="search__button"> <button class="button">Search</button> </div> </div> </section>
BEM // Modifier <section class="search"> <div class="search__content"> <input type="text" class="search__input">
<div class="search__button"> <button class="button button--small">Search</button> </div> </div> </section>
BEM // Modifier name + value <section class="search"> <div class="search__content">
<input type="text" class="search__input"> <div class="search__button"> <button class="button button--size-small">Search</button> </div> </div> </section>
BEM with CSS Block .block { … } Element .block__element
{ … } Modifier .block--modifier { … } .block__element--modifier { … }
BEM with SASS .block { &--modifier { … } }
.block__element { … } // searchable
BEM with SASS .block { &--modifier { … } }
.block__element { … } @include media($mq) { … // same structure here }
BEM with SASS .block { ... &:hover { … }
&:before { … } &--modifier { … } } .block__element { … } .block__long-element-name-here { … }
SASS Code Style • Always use .class selectors • No
#id as a selector • No tag as a selector • Max 2 levels for nesting • .util-text-overflow-break • .layout-page • 0, not 0px • #ccc, not #cccccc or #CCC • … More info https://sass-guidelin.es/
CSS properties order .selector { /* Positioning */ /* Display
& Box Model */ /* Color */ /* Text */ /* Other */ } More info https://css-tricks.com/poll-results-how-do-you-order-your-css-properties/
Thanks Q&A
Other Decks in Programming
See All in Programming
小さなアプリを作って公開するまで
onozaty
0
170
Growing PicoRuby's Ecosystem on ESP32
yuuu
2
130
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
380
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
210
protojson における文字化けの扱い
kazuki1023
0
420
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
240
Будущее локальных LLM – Алексей Голобурдин, PythoNN
sobolevn
0
120
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
620
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
310
Claude Code ハーネスDeep Dive – 君はどこまで制御する? -
takateeen_knj
6
5.7k
Spec-Driven Development - Why Vaadin Is the Perfect Fit
simas
PRO
0
250
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
340
Featured
See All Featured
For a Future-Friendly Web
brad_frost
184
11k
Raft: Consensus for Rubyists
vanstee
143
7.9k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
430
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
450
30 Presentation Tips
portentint
PRO
1
470
Docker and Python
trallard
47
4.3k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
Exploring anti-patterns in Rails
aemeredith
4
570
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
790
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.3k
Scaling GitHub
holman
464
140k