Spacing and Grid
Usage
Dynamic Layout
Dynamic layout allows you to easily define and apply layout configurations directly within your HTML. The layout settings are automatically converted to CSS and injected into the page, creating responsive and flexible layouts without additional stylesheets.
How to Use Dynamic Layouts
Setting Up Basic Layout
Add thedata-layoutattribute to your element with a value ofcol: *; row: *. Replace*with a valid value for each:col: Defines grid-template-columns.row: Defines grid-template-rows.
Responsive Layouts
For different screen sizes, use the following viewport-specific attributes:data-layout-sm: Small screensdata-layout-md: Medium screensdata-layout-lg: Large screensdata-layout-xlg: Extra-large screens
Each attribute lets you specify a unique layout configuration for the given viewport, enabling a responsive design across devices.
Styling Child Elements
To control the layout of child elements within a dynamic layout, use additional attributes on the child elements, specifying the style as you would in astyletag.
3 Column Grid
<div class="gap-3" data-layout="col: 1fr 1fr;" data-layout-sm="col: 100%" data-layout-xlg="col: 1fr 1fr 1fr">
<div class="box">A1</div>
<div class="box">A2</div>
<div class="box" data-layout-lg="grid-column: 1/3;" data-layout-md="grid-column: 1/3;">A3</div>
</div>2 Column Grid
<div class="gap-3" data-layout="col: 1fr 1fr;" data-layout-sm="col: 100%">
<div class="box">B1</div>
<div class="box">B2</div>
</div>