Challenge - 5 Problems
CSS Naming Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding BEM Naming Convention
Which of the following CSS class names correctly follows the BEM (Block Element Modifier) naming convention for a button component with a disabled state?
Attempts:
2 left
💡 Hint
BEM uses double hyphens for modifiers and double underscores for elements.
✗ Incorrect
In BEM, modifiers use double hyphens --. So button--disabled is correct for a disabled modifier of the button block.
📝 Syntax
intermediate2:00remaining
Valid CSS Class Name Syntax
Which of these CSS class names is invalid according to CSS naming rules?
Attempts:
2 left
💡 Hint
CSS class names cannot start with a digit.
✗ Incorrect
CSS class names cannot start with a number. Option A starts with '2', so it is invalid.
❓ selector
advanced2:00remaining
Selector Specificity with Naming Conventions
Given these CSS classes, which selector has the highest specificity?
CSS
.nav__item { color: blue; } .nav--active .nav__item { color: red; } .nav__item--highlighted { color: green; }
Attempts:
2 left
💡 Hint
More class selectors in a selector increase specificity.
✗ Incorrect
Option A has two class selectors combined, so it has higher specificity than the single-class selectors in A and C.
❓ layout
advanced2:00remaining
Naming Conventions Impact on CSS Grid Layout
If you have a CSS Grid container named
grid-container and grid items named grid-item--large and grid-item--small, which CSS rule correctly applies a larger grid area to the large item using these class names?Attempts:
2 left
💡 Hint
Match the exact class name with correct syntax.
✗ Incorrect
Option D uses the exact class name grid-item--large with correct CSS syntax to assign the grid area.
❓ accessibility
expert3:00remaining
Naming Conventions and Accessibility in CSS
Which naming convention practice best supports accessibility when styling components for screen readers and keyboard navigation?
Attempts:
2 left
💡 Hint
Good naming helps assistive technologies understand page structure.
✗ Incorrect
Descriptive class names help developers and assistive tools understand the purpose of elements, improving accessibility.