CSS for Drupal Themes: Best Practices 2026
Last updated: March 2026 · Reading time: 5 minutes
CSS is the language that gives your Drupal website its appearance. Fonts, colors, layouts, spacing, animations — everything is controlled via CSS. While HTML defines the structure and PHP provides the logic, CSS is responsible for the presentation.
In Drupal projects, CSS is more than styling: it affects load times, accessibility and your team's ability to evolve the theme.
CSS 2026: What Has Changed
CSS has evolved massively in recent years. Features that previously required preprocessors like Sass are now natively available:
Custom Properties (CSS variables) enable a central design token system. Colors, font sizes and spacing are defined once and referenced everywhere.
Container Queries allow components to respond to the size of their container — not just the viewport width. This makes component-based design more flexible than Media Queries.
Cascade Layers organize specificity in layers. Base styles, theme styles and utility classes are prioritized without specificity conflicts.
These features make CSS more powerful and reduce dependency on build tools. For Drupal themes, this means: less complexity in tooling, more control in the stylesheet.
CSS Architecture in Drupal Projects
Drupal comes with its own asset management. CSS files are defined as libraries and loaded only where needed. This is the foundation for performant stylesheets.
At arocom, we structure CSS by components: each UI component has its own stylesheet, included via Drupal's library system. The result: only the CSS needed on a page is loaded there.
Naming conventions like BEM (Block, Element, Modifier) create clarity in the team. Every developer knows where a style is defined and what impact a change will have.
Critical CSS for the above-the-fold area is delivered inline. The rest is loaded asynchronously. This improves the Largest Contentful Paint (LCP) and thus the Core Web Vitals.
Your next step
Is your CSS architecture scalable? The Drupal Future Check analyzes theme structure, performance and identifies CSS-related optimizations.
Do we still need Sass for Drupal themes?
Not necessarily. Custom Properties, nesting and Container Queries cover most use cases that previously required Sass. arocom uses native CSS with Custom Properties and forgoes preprocessors in new projects when requirements allow.
How do we reduce CSS file size?
Drupal's asset aggregation combines and minifies CSS files. Component-based CSS architecture loads only required styles. Critical CSS inline, the rest asynchronous. PurgeCSS removes unused rules. These measures reduce the CSS payload by 60-80%.
What are Container Queries and do we need them?
Container Queries allow a component to adapt its layout to the size of its container — not the viewport width. This is particularly useful in Drupal, where the same component is used in different layouts (sidebar, main area, grid).
Read more
- Frontend Development with Drupal — Theming, JavaScript and components
- UX Design for Drupal — Design as user experience
- Domain Strategy — Technical foundations before the relaunch
Discover a random article
Questions about this topic? We'd love to help.
CMS Comparison 2025
Drupal vs. WordPress vs. TYPO3: An objective comparison for enterprise projects.
Was this article helpful?