CSS CSS Professional Development 2 — Questions and Answers
Question 1: Which CSS methodology uses Block, Element, and Modifier naming to keep stylesheets maintainable?
- BEM (Correct answer)
- SMACSS
- OOCSS
- Atomic CSS
Correct answer: BEM
BEM stands for Block, Element, Modifier and structures class names accordingly.
Question 2: What does the CSS `will-change` property primarily help with?
- Hinting the browser to optimize upcoming animations (Correct answer)
- Changing element content
- Forcing a reflow immediately
- Disabling transitions
Correct answer: Hinting the browser to optimize upcoming animations
`will-change` tells the browser to prepare for a property change so it can optimize rendering.
Question 3: Which unit is relative to the font size of the root element?
- rem (Correct answer)
- em
- px
- vh
Correct answer: rem
`rem` is relative to the root (html) element's font size.
Question 4: In a CSS preprocessor like Sass, what symbol denotes a variable?
- $ (Correct answer)
- @
- %
- &
Correct answer: $
Sass variables are declared with a leading dollar sign.
Question 5: Which CSS feature lets you define reusable custom properties directly in CSS without a preprocessor?
- CSS variables (custom properties) (Correct answer)
- Mixins
- Placeholders
- Extends
Correct answer: CSS variables (custom properties)
Native CSS custom properties (var()) provide reusable values without a preprocessor.
Question 6: What is the main benefit of a CSS reset or normalize stylesheet?
- Consistent default styling across browsers (Correct answer)
- Faster JavaScript execution
- Smaller image sizes
- Better SEO scores
Correct answer: Consistent default styling across browsers
Reset/normalize stylesheets reduce cross-browser default styling inconsistencies.
Question 7: Which tool processes CSS with JavaScript plugins like Autoprefixer?
- PostCSS (Correct answer)
- Webpack only
- Babel
- ESLint
Correct answer: PostCSS
PostCSS transforms CSS using JavaScript plugins, including Autoprefixer.
Which CSS methodology uses Block, Element, and Modifier naming to keep stylesheets maintainable?