Horizontal
Horizontal
lets you lay things out horizontally.
-->
Horizontal
lets you lay things out horizontally.
Horizontal
lets you lay things out horizontally. It’s display: flex
but with a few extra features.
It just sounds… more descriptive (and more memorable) compared to flex
.
Horizontal
uses display:flex
underneath the hood so you can use all the Flexbox properties you’re used to.
Aligning items is simple as well — just use what Flexbox already provides you with.
Spacer
lets you create spaces between Horizontal
items. Think of it like justify-content: space-between
but with more control.
Horizontal
lets you lay things out horizontally. It’s basically just display: flex
with a couple of enhancements.
Since Horizontal
is just display:flex
, you can use justify-content
to align items horizontally.
Likewise, you can use align-items
to align items vertically.
You can change the gap
between items with the gap
property or the --gap
variable.
Items can be expanded to stretch the available width if you add flex-grow
to the item.
Horizontal
does not constraint the width of its children. If there is not enough space to contain them, the children will overflow out of its container.
To allow users to scroll through the content, use Scrollable
. (It’s more than just overflow: scroll
).
Horizontal
can have Spacer
items to create spaces between the current item and the previous ones. You can think of it like justify-between
but with more control.
This technique is often used to create layouts for navigation.
Spacer
is simply sets the left margin to auto
. (To be more precise, we set
margin-inline-start
).
One neat thing about Spacer
is you can treat it like an item. It’s super useful when you’re developing (and still unsure of the final layout).
One of the most common responsive tactics is to switch from a Vertical
layout to a Horizontal
layout when there is enough space.
You can use Tailwind Responsive modifiers to do this.
Splendid Labz is free because we love developers and we want to contribute back to the ecosystem.
We only charge for access to the documentation to keep the project going. If you don't wish to pay, feel free to use the content from the features tab, our blogs or our videos as your guide.
Horizontal
lets you lay things out horizontally. It’s basically just display: flex
with a couple of enhancements.
Since Horizontal
is just display:flex
, you can use justify-content
to align items horizontally.
Likewise, you can use align-items
to align items vertically.
You can change the gap
between items with the gap
property or the --gap
variable.
Items can be expanded to stretch the available width if you add flex-grow
to the item.
Horizontal
does not constraint the width of its children. If there is not enough space to contain them, the children will overflow out of its container.
To allow users to scroll through the content, use Scrollable
. (It’s more than just overflow: scroll
).
Horizontal
can have Spacer
items to create spaces between the current item and the previous ones. You can think of it like justify-between
but with more control.
This technique is often used to create layouts for navigation.
Spacer
is simply sets the left margin to auto
. (To be more precise, we set
margin-inline-start
).
One neat thing about Spacer
is you can treat it like an item. It’s super useful when you’re developing (and still unsure of the final layout).
One of the most common responsive tactics is to switch from a Vertical
layout to a Horizontal
layout when there is enough space.
You can use Tailwind Responsive modifiers to do this.
Here’s the CSS for Horizontal
.
Splendid Labz is free because we love developers and we want to contribute back to the ecosystem.
We only charge for access to the documentation to keep the project going. If you don't wish to pay, feel free to use the content from the features tab, our blogs or our videos as your guide.
Here’s the CSS for Horizontal
.
The justify-*
, items-*
and self-*
classes below require Tailwind. If you
don’t use Tailwind, you need to install our utilities to make these work.
Class | Description |
---|---|
justify-start | Aligns children items to the left. |
justify-center | Aligns children items to the center. |
justify-end | Aligns children items to the right. |
justify-around | Distributes spaces equally around items |
justify-between | Distributes space equally between items |
Class | Description |
---|---|
items-stretch | Default value. Stretch items. |
items-start | Aligns items to the top. |
items-center | Aligns items to the vertical center. |
items-end | Aligns items to the bottom. |
items-baseline | Aligns items to the baseline. |
Variable | Default | Description |
---|---|---|
--gap | 1rem | Gap between items |
Class | Description |
---|---|
Spacer | Creates a gap between this item and the one before |
Class | Description |
---|---|
self-start | Aligns item to the top. |
self-center | Aligns item to the vertical center. |
self-end | Aligns item to the bottom. |
self-stretch | Default value. Stretches the item. |
self-baseline | Aligns self to the baseline. |
Splendid Labz is free because we love developers and we want to contribute back to the ecosystem.
We only charge for access to the documentation to keep the project going. If you don't wish to pay, feel free to use the content from the features tab, our blogs or our videos as your guide.
The justify-*
, items-*
and self-*
classes below require Tailwind. If you
don’t use Tailwind, you need to install our utilities to make these work.
Class | Description |
---|---|
justify-start | Aligns children items to the left. |
justify-center | Aligns children items to the center. |
justify-end | Aligns children items to the right. |
justify-around | Distributes spaces equally around items |
justify-between | Distributes space equally between items |
Class | Description |
---|---|
items-stretch | Default value. Stretch items. |
items-start | Aligns items to the top. |
items-center | Aligns items to the vertical center. |
items-end | Aligns items to the bottom. |
items-baseline | Aligns items to the baseline. |
Variable | Default | Description |
---|---|---|
--gap | 1rem | Gap between items |
Class | Description |
---|---|
Spacer | Creates a gap between this item and the one before |
Class | Description |
---|---|
self-start | Aligns item to the top. |
self-center | Aligns item to the vertical center. |
self-end | Aligns item to the bottom. |
self-stretch | Default value. Stretches the item. |
self-baseline | Aligns self to the baseline. |