Recall & Review
beginner
What is a naming convention in CSS?
A naming convention is a set of rules to name CSS classes and IDs clearly and consistently so that the code is easy to read and maintain.
Click to reveal answer
beginner
Why use the BEM naming convention?
BEM (Block Element Modifier) helps organize CSS by naming classes to show their role and relationship, making styles easier to understand and avoid conflicts.
Click to reveal answer
intermediate
Example of a BEM class name for a button inside a header block with a modifier for a large size?header__button--large
Click to reveal answer
beginner
What is the benefit of using lowercase and hyphens in CSS class names?Using lowercase letters and hyphens makes class names easy to read and type, and it avoids errors caused by case sensitivity.Click to reveal answer
beginner
What should you avoid when naming CSS classes?
Avoid using vague names, spaces, special characters, or names that are too long or too short. Names should be meaningful and consistent.
Click to reveal answer
Which of these is a correct BEM class name for a modifier?
✗ Incorrect
BEM uses double hyphens for modifiers, like 'button--active'.
Why is it important to follow naming conventions in CSS?
✗ Incorrect
Consistent naming helps everyone understand and maintain the CSS code easily.
Which is a good practice for CSS class names?
✗ Incorrect
Lowercase letters and hyphens improve readability and avoid errors.
In BEM, what does the 'Element' part represent?
✗ Incorrect
Elements are parts inside a block, separated by double underscores.
Which of these is NOT recommended for CSS class names?
✗ Incorrect
Very long names make code harder to read and maintain.
Explain the BEM naming convention and why it helps in CSS.
Think about how BEM breaks down parts of a component.
You got /5 concepts.
List three best practices for naming CSS classes.
Focus on readability and avoiding errors.
You got /5 concepts.