Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
BEM - Los problemas de CSS y cómo se pueden ali...
Search
Guillermo Moreno
February 23, 2017
Programming
0
88
BEM - Los problemas de CSS y cómo se pueden aliviar
Presentación para Platanus en Febrero 2017
Guillermo Moreno
February 23, 2017
Tweet
Share
More Decks by Guillermo Moreno
See All by Guillermo Moreno
Desarrollo Móvil en Javascript: Cordova y React Native
gmq
0
120
Other Decks in Programming
See All in Programming
AIエージェントはこう育てる - GitHub Copilot Agentとチームの共進化サイクル
koboriakira
0
380
PHPで始める振る舞い駆動開発(Behaviour-Driven Development)
ohmori_yusuke
2
190
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
320
「ElixirでIoT!!」のこれまでとこれから
takasehideki
0
370
「Cursor/Devin全社導入の理想と現実」のその後
saitoryc
0
150
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
330
NPOでのDevinの活用
codeforeveryone
0
240
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
240
たった 1 枚の PHP ファイルで実装する MCP サーバ / MCP Server with Vanilla PHP
okashoi
1
190
関数型まつりレポート for JuliaTokai #22
antimon2
0
150
Is Xcode slowly dying out in 2025?
uetyo
1
190
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
46
31k
Featured
See All Featured
Navigating Team Friction
lara
187
15k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
930
GitHub's CSS Performance
jonrohan
1031
460k
RailsConf 2023
tenderlove
30
1.1k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Mobile First: as difficult as doing things right
swwweet
223
9.7k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
What's in a price? How to price your products and services
michaelherold
246
12k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
Building Applications with DynamoDB
mza
95
6.5k
A designer walks into a library…
pauljervisheath
207
24k
Transcript
BEM BLOCK ELEMENT MODIFIER AKA: LOS PROBLEMAS DE CSS Y
CÓMO SE PUEDEN ALIVIAR
<div class="sidebar"> <h2>Secciones</h2> <ul> <li>Home</li> <li>Contacto</li> </ul> <h2>Sponsors</h2> <ul> <li>Platanus</li>
<li>Google</li> </ul> </div> .sidebar h2 { font-size: 1em; color: red; } .sidebar ul { list-style: none; } .sidebar ul li { font-size: .8em; } ¿PROBLEMAS EN CSS?
Secciones Home Contacto Sponsors Platanus Google
<div class="sidebar"> <h2>Secciones</h2> <ul> <li>Home</li> <li>Contacto</li> </ul> <h2 class="sponsors">Sponsors</h2> <ul
class="sponsors"> <li id="platanus">Platanus</li> <li>Google</li> </ul> </div> .sidebar h2 { font-size: 1em; color: red; } .sidebar ul { list-style: none; } .sidebar ul li { font-size: .8em; } .sidebar h2.sponsors { color: blue; } #platanus { color: yellow; text-decoration: underline; }
Secciones Home Contacto Sponsors Platanus Google
<div class="sidebar"> <h2>Secciones</h2> <ul> <li>Home</li> <li>Contacto</li> </ul> <h2 class="sponsors">Sponsors</h2> <ol
class="sponsors"> <li id="platanus">Platanus</li> <li>Google</li> </ol> </div>
Secciones Home Contacto Sponsors 1. Platanus 2. Google
ol { color: pink; } /* --- */ .sidebar h2
{ font-size: 1em; color: red; } .sidebar ul { list-style: none; } .sidebar ul li { font-size: .8em; } .sidebar h2.sponsors { color: blue; } #platanus {
<div class="sidebar"> <h2>Secciones</h2> <ul class="secciones"> <li>Home</li> <li id="platanus">Platanus</li> <li>Contacto</li> </ul>
<h2 class="sponsors">Sponsors</h2> <ol class="sponsors"> <li id="platanus">Platanus</li> <li>Google</li> </ol> </div> /* ... */ #platanus { color: yellow; text-decoration: underline; } .secciones * { text-decoration: none; }
Secciones Home Platanus Contacto Sponsors 1. Platanus 2. Google
Especi cidad. #platanus es mucho más especi co que .secciones
Fragilidad. el cambio de ul a ol rompió código que no debería haber roto Poco modular. El estilo de ol de otra parte de la página cambió el estilo de nuestra PROBLEMAS
BEM BLOCK * ELEMENT * MODIFIER
UN COMPONENTE O ENTIDAD QUE TIENE SIGNIFICADO POR SI MISMO
Y ES INDEPENDIENTE DEL RESTO BLOCK
PARTES DE UN BLOQUE QUE NO TIENEN SIGNIFICADO FUERA DE
ÉL. NOMBRE DE LA SECCIÓN + DOS GUIONES BAJOS. .sidebar__titulo .sidebar-section__link .btn__icon ELEMENT
IDENTIFICA CAMBIOS DE APARIENCIA O COMPORTAMIENTO EN UN ELEMENTO O
BLOQUE. NOMBRE DEL BLOQUE O ELEMENTO + DOS GUIONES. .sidebar__titulo--primary .sidebar-section__link--platanus MODIFIER
.sidebar__title { font-size: 1em; color: red; } .sidebar__list { list-style:
none; } .sidebar__item { font-size: .8em; } .sidebar__item--underline { text-decoration: underline; } .sidebar__title--sponsors { color: blue; } .sidebar__item--platanus { color: yellow; <div class="sidebar"> <h2 class="sidebar__title">Secciones</ <ul class="sidebar__list"> <li class="sidebar__item">Home</li> <li class="sidebar__item sidebar__item--platanus <li class="sidebar__item">Contacto</ </ul> <h2 class="sidebar__title--sponsors"> <ol> <li class=" sidebar__item sidebar__item--platanus sidebar__item--underline ">Platanus</li> <li class="sidebar__item">Google</li </ol> </div>