
Discover clean, modular, and scalable CSS architecture that mitigates cascade and specificity issues, enabling maintainable, reusable styles driven by selector-based architecture.
Explore how a monolithic CSS file causes overridden styles due to specificity, and apply object-oriented principles to build a scalable stylesheet that follows design order rather than browser order.
Assess prerequisites to ensure you’re ready for a non-beginner CSS architecture course. Emphasize understanding the problem over coding and learn to choose the right CSS methodologies for your product.
Explore applying object oriented principles to css for a cleaner, scalable architecture. Learn solid principles, dry, immutability, and separation of concerns with simple examples.
Explore how CSS specificity decides which rule applies by weighing ID, class, and type selectors, and visualize spikes in a specificity graph.
Explore the single responsibility principle in CSS architecture, showing how a class should have one reason to change, with modular, reusable button styles built from base, color, and size classes.
Apply the open-closed principle to css by keeping the base class simple and avoiding changes that affect many elements; use sass extend and mixes to extend without modifying the base.
Explore the Liskov substitution principle from SOLID, showing how base and subclass classes should behave identically and be swappable in CSS without breaking layout.
Apply the interface segregation principle by splitting base CSS classes into smaller, focused ones like movable and flyable. Adopt the single responsibility principle to keep base classes small and refactor-friendly.
Apply the dependency inversion principle to CSS by making modules depend on abstractions. Reduce coupling, ensure independence, and avoid descendent selectors that tie parent and child.
Explore decoupling CSS from HTML to improve reusability and maintainability by reducing specificity, avoiding deeply nested selectors, and applying loosely coupled classes to any element.
Apply the dry principle to prevent repeating CSS properties by grouping shared information, ensuring every discrete piece exists only once, for easier maintenance and a scalable stylesheet.
Explore immutability in CSS, showing how mutations from cascading styles cause unpredictable outcomes, and how applying single responsibility and controlled use of !important helps create predictable, decoupled styles.
Embrace separation of concerns by decoupling HTML, CSS, and JavaScript, using classes for styling and IDs for scripting to keep code maintainable and safe to modify.
Discover how to keep specificity low and apply object-oriented principles, solid principles, dry, immutability, and separation of concerns to CSS, with upcoming sections showing how popular methodologies implement these ideas.
Discover the core of object oriented CSS (OOCSS) by breaking down layouts into reusable CSS objects that embody the single responsibility principle, then apply them across pages.
Identify patterns and objects to reduce repetition by using a simple reusable 'media' object, an image on the left with content on the right, adaptable to icons, avatars, or videos.
Explore oocss concepts by separating structure from skin and container from content, use reusable structure and skin classes, and apply the single responsibility principle to decouple css from html.
Explore oocss standards to build reusable, scalable css by decoupling css from html, using classes instead of ids, and embracing separation of structure from skin and container from content.
Explore the bem methodology, including block, element, and modifier naming, to build reusable components with clear scope and scalable css architecture for front-end teams.
Discover how BEM provides a contextual, reusable CSS structure by composing blocks, elements, and modifiers with unique class names, ensuring readable, conflict-free styles.
Compare bem and oocss to explain why flat specificity matters, with a 0-1-0 graph and no nested selectors, and see how card__image stays in the card block to prevent overrides.
Explore the parallels between bem and oocss, learn to design reusable css modules or blocks, apply naming conventions, and keep a flat, dry, low-specificity architecture for scalable css.
Identify patterns and objects in your css by balancing blocks, elements, and modifiers to avoid overmodulizing, reuse blocks like cart and image, and keep components meaningful.
Explore the trade-offs between overmodulized code, BEM, OOCSS, and atomic CSS, weighing readability, context, and performance while comparing utility classes to traditional CSS architecture.
Explore ITCSS, or inverted triangle architecture, a structured, scalable CSS method not a library or framework but compatible with OOCSS and BEM, with or without a preprocessor, to manage specificity.
Learn to organize CSS with ITCSS, moving from generic to elements/base, object, components, and utilities in specificity order to prevent spiky graphs.
Explore the inverted triangle approach to clean, scalable CSS, focusing on increasing specificity, explicitness, and shrinking reach across a single stylesheet from line 1 to 5000, to prevent specificity wars.
Explore ITCSS folder structure and naming conventions, where main.scss imports all layer partials like _objects.media.scss, and class names use a layer prefix with hyphen and element naming for consistency.
Explore ITCSS flexibility and naming options like BEMIT to fit your stack, start with low-specificity generic selectors, then progressively add styles, and reduce stylesheet size for performance.
CSS is easy, it’s easy to learn, it’s easy to write.
But actually, it’s hard to write scalable and maintainable code especially with large projects that require constant scaling…
There are many reasons why this is the case:
- In CSS everything is in a global scope. Any change in one file can cause an (un)expected result in another element, or page.
- CSS is a highly mutable language, because of it's cascade nature. Each mutation leads to confusion and unexpected results.
- CSS highly depends on the source order.
- On the other hand, specificity can undo everything. It doesn't matter how you structure your code, specificity can break everything. Specificity is one of the biggest problems of CSS.
- CSS is not (easily) scalable
We end up in a cycle of writing more CSS just to fix the old CSS! At some point our whole CSS code becomes too messy and too large. We need a better approach, we need a modular and predictable CSS. CSS language has not evolved since 1998. There are preprocessors, but they are not solving the main CSS issues. After all, SASS and Less are compiling to CSS.
In this course, we will talk about the CSS architecture, and how to write clean and maintainable code. Our goal is to write CSS that should be:
- Predictable: CSS rules behave as we expect them to.
- Reusable: When adding new components, we shouldn't need to recode patterns or problems we've already solved.
- Maintainable: New features, components, or updates shouldn't require refactoring our CSS and should NOT break existing components.
The idea is taking the OO philosophy you already learned in Java, PHP, C# and finding a way to translate that into CSS as well. All that you learned in OOP languages, all the DRY principles, SOLID, SRP, immutability we can apply to CSS in some way. Simple is the best.
There are many advanced courses about CSS, about flexbox, CSS animations, CSS grid… However, in this course, we will be focusing on the architecture of CSS. If you are interested in learning how to write clean and scalable CSS code, this course is the right thing for you!
This is a course I wish I had when I started working on more complex projects.