Overview: trends and techniques in CSS – variables, CSS-in-JS, frameworks, Grid, animations, dark mode, Houdini, and accessibility.
CSS variables
Custom properties let you store values once and reuse them. Changing a theme site-wide can mean updating a handful of variables instead of hundreds of rules.
:root {
--primary-color: #007bff;
}
button {
background-color: var(--primary-color);
}
CSS-in-JS
CSS-in-JS writes styles through JavaScript, often in React projects. Styles can respond to props and component state directly.
const Button = styled.button`
background-color: ${props => props.primary ? 'navy' : 'white'};
color: ${props => props.primary ? 'white' : 'navy'};
`;
Libraries such as Styled Components popularised this pattern.
CSS frameworks
Bootstrap and Tailwind CSS continue to evolve. Utility-first frameworks like Tailwind combine small classes to build components:
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
Button
</button>
Grid and Flexbox
Grid handles two-dimensional layouts. Flexbox handles one-dimensional alignment. Both are now standard tools for page structure.
.grid-container {
display: grid;
grid-template-columns: repeat(3, 1fr);
}
Transitions and animations
CSS animations handle plenty of UI feedback without JavaScript overhead:
.fade-in {
animation: fadeIn ease 2s;
}
@keyframes fadeIn {
0% {opacity:0;}
100% {opacity:1;}
}
Dark mode
Dark mode is common in apps and operating systems. CSS variables and media queries make theme switching straightforward:
body[data-theme="dark"] {
background-color: black;
color: white;
}
You can also respond to the user’s system preference with prefers-color-scheme.
CSS Houdini
Houdini is a set of APIs that expose parts of the browser’s CSS engine. Paint worklets, for example, let you define custom background patterns in code:
if ('paintWorklet' in CSS) {
CSS.paintWorklet.addModule('path-to-worklet-module.js');
}
Support is still limited, but Houdini opens up possibilities that plain CSS cannot reach yet.
Accessibility
Accessible design is not optional. CSS plays a part in focus visibility, contrast, and readable layouts:
a:focus {
outline: 3px solid blue;
}
Do not remove focus outlines without providing a visible alternative.
Staying up to date
- Follow developments: Blogs, specs, and community discussions cover what is landing in browsers.
- Try things out: Small experiments teach you more than reading alone.
- Prioritise performance and accessibility: New features are only worth using if they work well for everyone.
CSS keeps gaining features – variables, Grid, container queries, and more. Pick what solves a real problem on your project rather than chasing every new property.

