Card
Card
is a component that provides default border
and padding
values. It also contains Card-split
which lets you divide cards up into several sections effortlessly.
-->
Card
is a component that provides default border
and padding
values. It also contains Card-split
which lets you divide cards up into several sections effortlessly.
It just provides default padding
and border
values so you can create cards easily.
You can use Card-split
which lets you create cards that can easily be divided into multiple sections.
Card-split
works flawlessly with Divider
and DividerBetween
to create dividers as you wish.
We hope you never have to make monstrous cards, but if you ever need to, just know that it’s pretty easy.
Card-split
and DividerBetween
goes a long way to make almost any card you can imagine.
Keeping padding
and border
styles consistent is a cinch if you change the --padding
and border variables we provide. Just check this demo out!
--nudge
inside Card-split
also creates automatic nested border radius calculation. So you can get beautiful cards with much less work.
Card
lets you create a component with default values for padding
and border
.
All Cards use the following CSS variables. We recommend changing them globally in the :root
to ensure all cards have a consistent look and feel.
Dividers use the same --border-width
,
--border-style
and --border-color
variables as well. We keep variables
consistent for easier styling across components.
A basic Card
is insufficient if you want to create Cards that are sectioned with different backgrounds, mostly because you need to…
padding
from Card
gaps
you may be usingpadding
to all elements within itoverflow-hidden
to prevent item backgrounds from leaking out of the card …And that’s lot of work 💦. So we made things simpler with Card-split
which does all of the above for you.
If you want cards to be divided horizontally, you can use Horizontal
class. You can even add an (optional) Divider
.
If you want your card items to be split exactly in half, you can use SimpleGrid
. (Nobody says you can’t use macro layout tools within a component!).
If you want to add a divider in this case, you should use DividerBetween
instead of Divider
. (Because Divider
includes an extra element which screws up --cols
while DividerBetween
doesn’t).
Likewise, you can also use DividerBetween
to split card items vertically without adding extra Dividers
.
Occassionally, you may be tasked with complex cards that contain both Horizontal and Vertical dividers.
Although I sincerely hope you don’t have to create such a montrosity, I still want to let you know you can accomplish it with a mix of the techniques we mentioned above.
If you change the CSS variables mentioned above, you can change the padding
and border
values used for Card
, Card-split
, Divider
and DividerBetween
— even for complex cards — because they share the same values.
Card-split
calculates nested border radius for children elements if you provide it with --radius
and --nudge
.
--radius
: Defines the border-radius
of the Card
element--nudge
: Defines the amount of margins created around the child elementIf you want to provide custom nested radius for the item, simply choose not to use --nudge
. Do note that you will need to provide a border-radius
declaration with a higher specificity to do so.
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.
Card
lets you create a component with default values for padding
and border
.
All Cards use the following CSS variables. We recommend changing them globally in the :root
to ensure all cards have a consistent look and feel.
Dividers use the same --border-width
,
--border-style
and --border-color
variables as well. We keep variables
consistent for easier styling across components.
A basic Card
is insufficient if you want to create Cards that are sectioned with different backgrounds, mostly because you need to…
padding
from Card
gaps
you may be usingpadding
to all elements within itoverflow-hidden
to prevent item backgrounds from leaking out of the card …And that’s lot of work 💦. So we made things simpler with Card-split
which does all of the above for you.
If you want cards to be divided horizontally, you can use Horizontal
class. You can even add an (optional) Divider
.
If you want your card items to be split exactly in half, you can use SimpleGrid
. (Nobody says you can’t use macro layout tools within a component!).
If you want to add a divider in this case, you should use DividerBetween
instead of Divider
. (Because Divider
includes an extra element which screws up --cols
while DividerBetween
doesn’t).
Likewise, you can also use DividerBetween
to split card items vertically without adding extra Dividers
.
Occassionally, you may be tasked with complex cards that contain both Horizontal and Vertical dividers.
Although I sincerely hope you don’t have to create such a montrosity, I still want to let you know you can accomplish it with a mix of the techniques we mentioned above.
If you change the CSS variables mentioned above, you can change the padding
and border
values used for Card
, Card-split
, Divider
and DividerBetween
— even for complex cards — because they share the same values.
Card-split
calculates nested border radius for children elements if you provide it with --radius
and --nudge
.
--radius
: Defines the border-radius
of the Card
element--nudge
: Defines the amount of margins created around the child elementIf you want to provide custom nested radius for the item, simply choose not to use --nudge
. Do note that you will need to provide a border-radius
declaration with a higher specificity to do so.
Here’s the CSS for Card
and Card-split
.
The astro-island
and astro-slot
selectors help to alleviate styling frustrations when using Astro.
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 Card
and Card-split
.
The astro-island
and astro-slot
selectors help to alleviate styling frustrations when using Astro.
Class | Description |
---|---|
Box | Alias of Card |
Class | Description |
---|---|
Card-split | Creates a card that can be split into multiple sections. |
Variable | Default | Description |
---|---|---|
--padding | 1rem | Padding |
--border-width | 1px | Border width |
--border-style | solid | Border style |
--border-color | black | Border colour |
--radius | 0.5rem | Border radius |
Variable | Default | Description |
---|---|---|
--nudge | 1rem | Amount to push towards the center of the card on both block and inline axis |
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.
Class | Description |
---|---|
Box | Alias of Card |
Class | Description |
---|---|
Card-split | Creates a card that can be split into multiple sections. |
Variable | Default | Description |
---|---|---|
--padding | 1rem | Padding |
--border-width | 1px | Border width |
--border-style | solid | Border style |
--border-color | black | Border colour |
--radius | 0.5rem | Border radius |
Variable | Default | Description |
---|---|---|
--nudge | 1rem | Amount to push towards the center of the card on both block and inline axis |
Cards have the overflow: hidden
property to prevent backgrounds of children elements from leaking out of the border radius area.
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.
Cards have the overflow: hidden
property to prevent backgrounds of children elements from leaking out of the border radius area.