Styles class provides a type-safe way to define inline CSS styles for HTML elements in Jaspr. It supports all common CSS properties with compile-time type checking.
Constructor
Basic Usage
Box Properties
Dimensions
Element width using CSS units (px, em, rem, %, vh, vw, etc.)
Element height.
Minimum width constraint.
Maximum width constraint.
Minimum height constraint.
Maximum height constraint.
Aspect ratio of the element.
Spacing
Inner spacing around content.
Outer spacing around element.
Display & Position
Display mode of the element.
Positioning scheme.
Stack order of positioned elements.
Borders & Outlines
Element border.
Border corner radius.
Outline around element (doesn’t affect layout).
Visual Effects
Transparency level (0.0 to 1.0).
Drop shadow effect.
Visual filters like blur, brightness, etc.
2D/3D transformations.
Text Properties
Text color.
Font size.
Font weight/thickness.
Font family.
Horizontal text alignment.
Line height/spacing.
Flexbox Properties
Main axis direction.
Alignment along main axis.
Alignment along cross axis.
Spacing between flex/grid items.
Background Properties
Background color.
Background image.
How background image is sized.
Combining Styles
Raw CSS Properties
Add any CSS property not covered by the type-safe API.
Complete Example
See Also
- @css Annotation - Define global styles
- Style Component - Render style rules
- CSS Units - Available CSS unit types