More actions
mNo edit summary |
mNo edit summary |
||
Line 2: | Line 2: | ||
.template-flexbox { | .template-flexbox { | ||
display: flex; | display: flex; | ||
gap: var(--template-flexbox-gap); | gap: var(--template-flexbox-gap); /* space between items */ | ||
flex-wrap: wrap; | flex-wrap: wrap; | ||
flex-direction: var(--template-flexbox-direction); | flex-direction: var(--template-flexbox-direction); | ||
Line 11: | Line 11: | ||
.template-flexbox-item { | .template-flexbox-item { | ||
--template-flexbox-item-span: 1; /* Default span is 1 */ | --template-flexbox-item-span: 1; /* Default span is 1 */ | ||
--template-flexbox-item-width: calc((100% | --template-flexbox-item-width: calc((100% - (var(--template-flexbox-gap) * (var(--template-flexbox-columns) - 1))) / var(--template-flexbox-columns)); | ||
flex-basis: var(--template-flexbox-item-width); | flex-basis: var(--template-flexbox-item-width); /* set the width of each column */ | ||
flex-grow: 0; /* Prevent growing */ | flex-grow: 0; /* Prevent growing */ | ||
flex-shrink: 0; /* Prevent shrinking */ | flex-shrink: 0; /* Prevent shrinking */ | ||
} | } | ||
Revision as of 17:01, 28 December 2024
/* Container for the flexbox */ .template-flexbox { display: flex; gap: var(--template-flexbox-gap); /* space between items */ flex-wrap: wrap; flex-direction: var(--template-flexbox-direction); --template-flexbox-columns: 3; /* Default columns count */ } /* Flex items */ .template-flexbox-item { --template-flexbox-item-span: 1; /* Default span is 1 */ --template-flexbox-item-width: calc((100% - (var(--template-flexbox-gap) * (var(--template-flexbox-columns) - 1))) / var(--template-flexbox-columns)); flex-basis: var(--template-flexbox-item-width); /* set the width of each column */ flex-grow: 0; /* Prevent growing */ flex-shrink: 0; /* Prevent shrinking */ } /* Media query for different screen sizes */ @media (max-width: 1120px) { .template-flexbox { --template-flexbox-columns: 2 !important; } } @media (max-width: 640px) { .template-flexbox { --template-flexbox-columns: 1 !important; } }