CSS Assignment – 6
Basic Questions
- Re-write CSS for a button using separate class selectors instead of applying styles directly to the <button>.
- Create a style rule that uses a meaningful class name like .btn-primary instead of .red-button.
- Practice converting messy CSS classes into BEM format (.card__title, .card__button).
- Create a global CSS reset using * { margin: 0; padding: 0; }.
- Divide CSS into base, layout, and component files in a small project.
- Move inline styles from HTML into an external CSS file.
- Create CSS variables (–primary-color, –font-heading) for a landing page.
- Use shorthand for margin and padding (e.g., margin: 10px 20px;).
- Optimize CSS by grouping selectors that share the same style.
- Practice removing styles that are not applied to any HTML element.
- Create a hero section with separate BEM classes (.hero__title, .hero__subtitle, .hero__button).
- Convert a messy .col1 .col2 .col3 grid into a more meaningful flex/grid layout.
- Create a button hover effect with clean BEM (.btn–hover).
- Apply a consistent font-family across the project using root-level style.
- Optimize CSS by using one class for reusability instead of repeating inline styles on multiple divs.
- Write CSS class names in lowercase with hyphens (.main-nav) instead of camelCase.
- Document a CSS file with comments, grouping resets, typography, layout, and components.
- Create a responsive card layout with clear, reusable class names.
- Use minify tools or compressed form of CSS and compare with original.
- Create a 3-line comment block describing a CSS file’s module.
Intermediate Questions
- Refactor a basic navigation bar with BEM naming (.nav, .nav__item, .nav__link, .nav__link–active).
- Build a footer with BEM modifiers for theme (.footer–dark, .footer–light).
- Organize a portfolio CSS file into typography.css, layout.css, components.css.
- Create CSS variables for an entire project’s color palette & fonts.
- Use nesting (if available with PostCSS/SASS-like preprocessor) for .card > p.
- Split a single CSS file into partials (header.css, footer.css, etc.) & merge using @import.
- Practice using responsive units (rem, vw) instead of fixed px for maintainability.
- Identify and clean up duplicate CSS declarations in a file.
- Write CSS for .btn–small, .btn–medium, .btn–large variants with BEM modifiers.
- Re-organize bad class names (.box1, .box2) into proper semantic BEM names.
- Build a simple portfolio landing section with separate .portfolio__title, .portfolio__image
- Create a grid-based product card layout with .product__title, .product__image.
- Add hover effects using BEM (.product__button–hover).
- Optimize CSS in an e-commerce product listing page by using utility classes like .text-center.
- Create a responsive navigation bar with .nav__menu, .nav__item, .nav__toggle.
- Apply different spacing using utility classes (.m-1, .m-2) for consistency across a project.
- Implement media queries in a separate responsive.css file.
- Build a 2-column layout landing page with clean BEM classes.
- Add a call-to-action button styled using a reusable .btn + modifier.
- Use CSS variables (–padding-section, –primary-color) in a multi-section landing page.
Advanced Questions
- Refactor an entire multi-page website to use BEM methodology consistently (header, footer, sections, buttons).
- Optimize CSS by removing 30% unused rules using dev tools (e.g., Chrome Coverage or PurgeCSS).
- Write a style guide file (style.css) that includes base variables, colors, typography, utility classes, and reusables.
- Split a large CSS project into modular approach → base/, components/, layout/, themes/.
- Build a fully responsive personal portfolio with grid/flex sections: About Me, Projects, Contact.
- Create a responsive landing page for a startup (Hero, Features, Pricing, CTA).
- Build a complete e-commerce product listing page (grid of products + filters sidebar) with clean CSS organization.
- Design an animated dashboard page with BEM classes for .dashboard__card, .dashboard__chart, etc.
- Implement a theme switcher (light/dark) across an entire site using only CSS variables.
- Create a multi-page site (Home, About, Contact) using modular CSS + responsive layouts.