dev-resources.site
for different kinds of informations.
How come my grid has giant gaps?
Published at
4/11/2024
Categories
css
help
watercooler
Author
Calin Baenen
So I am working on my CSS library, Spark, and I am trying to demonstrate the grid-layout capabilities ov it...
... However, I am displeased by the disproportionate amount ov whitespace between each column, and I don't know what is causing it.
I've tried setting both gap
and grid-gap
to 0
and have made sure that there are no margins and no padding on the grid, or the grid-items.
The CSS for  (that applies to*)  the highlighted grid boils down to this:
* {
box-sizing:border-box;
max-height:100%;
max-width:100%;
height:fit-content;
}
*[data-flow~="grid"] {
grid-template-columns:repeat(2, 1fr);
grid-template-rows:repeat(1, 1fr);
grid-auto-columns:1fr;
grid-auto-rows:1fr;
display:grid;
}
*[data-flow~="row"] {
grid-auto-flow:row;
}
*[data-padding="char"] { padding:1em; }
.box-container {
background-color:red;
width:100%;
}
.box-container[data-flow~="grid"] { gap:1em; }
The weird thing is is that when I change the flow to columns, the spacing looks as it should:
So... what's going on here? (Why does spacing work properly between rows and not columns?)
How can I fix this behavior?
Articles
12 articles in total
I Got A Perfect (100%) Score in My College-Level Python Course!
read article
CSS Grid-Layout Sucks, And Here's Why
read article
Microsoft Is Holding My Account HOSTAGE!
read article
Happy Pride Month, Everyone!
read article
Support My Movement To Spell "Of" as "Ov"!
read article
This SUPERIOR way ov defining enums in JavaScript!
read article
Demonstrating AI's Innocence Through Food
read article
5 Productivity Hacks to Supercharge Your Coding Sessions
read article
How come my grid has giant gaps?
currently reading
Spark v2.2.0 is here!
read article
Announcing Spark: an easy-to-use CSS library for complex styles.
read article
RuntDeale DevLog : ...1?
read article
Featured ones: