css Template
The css template literal lets you write styles using plain CSS syntax.
Basic Usage
When to Use
Use css instead of styl when you:
- Prefer standard CSS syntax
- Are migrating from another CSS-in-JS solution
- Want to copy/paste CSS from other sources
- Don't need Stylus features like variables or mixins
Placement
Works the same as styl — inside a function for component-scoped styles, or at module level for shared styles:
Syntax
Standard CSS with all familiar features:
The u Unit
The custom u unit works in css too:
Supported Features
Media Queries
CSS Variables
Part Selectors
Limitations
The css template does not support:
- Stylus variables (
$var) - Stylus mixins
- Global
styles/index.stylimports
For these features, use the styl template instead.
Comparison
See Also
- styl Template — Stylus syntax with variables and mixins
- styleName Prop — Connect elements to styles