CSS is the layout and design language for an HTML interface. HTML supplies structure and data; CSS controls presentation; JavaScript adds behavior when needed. Vanilla CSS means using modern CSS directly rather than making a preprocessor or styling framework the foundation of the interface. It is a practical choice, not a ban on tooling. section 3.1 section 1.2
Start with small stylesheets and names that describe a UI role, not an appearance. Keep selectors short and stable rather than increasing specificity to force a result. Native custom properties hold design tokens and theme values; cascade layers establish an order for resets, base rules, components, and utilities. These features make changes easier to reason about without requiring a preprocessor. section 4.0 section 4.4
Choose the CSS primitive that matches the interface problem:
- Use Flexbox for one-dimensional alignment, Grid for two-dimensional tracks, and Subgrid when items need shared columns. section 4.4
- Use container queries when a component should respond to its parent’s size rather than the viewport. Viewport and text-relative units address other responsive sizing needs. section 4.4
- Use selectors such as :is(), :where(), :has(), and :focus-visible to express states and relationships without adding unnecessary markup. section 4.4
- Use transitions for state changes and keyframes for choreographed motion. Honor prefers-reduced-motion; favor transform and opacity for performance. section 4.4
/* Minimal reset and base tokens */
:root {
--space-2: .5rem; #1
--space-3: .75rem; #1
--radius: 12px; #1
--brand: #5d4037; #1
}
* { #2
box-sizing: border-box; #2
} #2
img { #2
max-width: 100%; #2
height: auto; #2
display: block; #2
} #2
nav { #3
button { #3
border-radius: var(--radius); #4
background: var(--brand); #4
color: #fff;
}
}
A minimal stylesheet combines root-level spacing, radius, and color tokens with a small reset. A nested navigation-button rule then consumes those tokens, showing how native CSS can express a compact design system. section 4.0
Use HTML and CSS as the default for content-based interfaces; Canvas can serve specific graphics or charts. CSS need not replace every tool: linting and continuous-integration checks can still support maintainability. The aim is to remove abstraction that does not help the requirements, not to recreate old layout techniques or avoid useful tools. section 3.1 section 4.1 section 2.3













