0
0
SASSmarkup~5 mins

BEM naming with SASS nesting - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does BEM stand for in CSS naming?
BEM stands for Block, Element, Modifier. It is a way to name CSS classes to keep code organized and clear.
Click to reveal answer
beginner
How does SASS nesting help when using BEM naming?
SASS nesting lets you write CSS inside other CSS rules. This matches BEM’s structure, making code shorter and easier to read.
Click to reveal answer
beginner
In BEM, what is a 'Block'?
A Block is a standalone component that can be reused, like a button or a menu.
Click to reveal answer
beginner
What is the correct BEM class name for a button element inside a form block?
If the block is 'form' and the element is 'button', the class name is 'form__button'.
Click to reveal answer
beginner
How do you write a modifier for a block in BEM?
Add two dashes and the modifier name after the block, like 'button--primary' to show a primary style.
Click to reveal answer
What is the purpose of BEM naming in CSS?
ATo reduce the size of CSS files
BTo organize CSS classes clearly and avoid conflicts
CTo make CSS run faster
DTo automatically generate CSS animations
In BEM, how do you name an element inside a block?
Ablock__element
Bblock-element
Cblock--element
Delement__block
How does SASS nesting improve writing BEM styles?
AIt compiles CSS faster
BIt automatically renames classes
CIt lets you write element styles inside the block style for clarity
DIt removes the need for modifiers
What does a BEM modifier class look like?
Amodifier--block
Bblock__modifier
Cblock_modifier
Dblock--modifier
Which SASS code snippet correctly nests BEM styles for a block 'card' with element 'title'?
A.card { &__title { color: blue; } }
B.card { .title { color: blue; } }
C.card__title { color: blue; }
D.card-title { color: blue; }
Explain how BEM naming works and why it is useful in CSS.
Think about how you name parts of a car: car (block), car__wheel (element), car--red (modifier).
You got /4 concepts.
    Describe how you use SASS nesting to write BEM styles more easily.
    Imagine putting smaller boxes inside a bigger box to keep things tidy.
    You got /4 concepts.