How to create two aligned columns with unknown items size.

I have card like this: https://codepen.io/H4ds0n/pen/RwzVMKG What I want is two columns (i do not know the width of label and its percentage at build time). Two even grid column is bad because parent container is too big for its children. Flexbox wont work because size of children is not know at the build time (cannot set something like with:300 px) and I would like to make it resposive. Any advices ?
H4ds0n
CodePen
RwzVMKG
...
19 Replies
damn
damn•3mo ago
hi? u cant create it using percentages
interpod
interpod•3mo ago
this iw what I would expect
No description
interpod
interpod•3mo ago
For wider screens -
damn
damn•3mo ago
imma try
interpod
interpod•3mo ago
what you mean percentage?
b3hold
b3hold•3mo ago
grid-template-columns: auto 1fr; doesnt work?
interpod
interpod•3mo ago
its like <ol> <li><span>....</span><span>...</span></li> </ol> then i will have to ditch li i guess At first it seems like some candidate for subgrid but them meh wasn't able to do anything with it
damn
damn•3mo ago
something like this?
interpod
interpod•3mo ago
not exacly, what I am trying is to avid this big gap
damn
damn•3mo ago
oh you can give a min-width like 20% or something
b3hold
b3hold•3mo ago
i think u need to remove width:50% from the items and it would solve the issue the gap issue
b3hold
b3hold•3mo ago
No description
b3hold
b3hold•3mo ago
something like this?
damn
damn•3mo ago
so quick question does the code update if i make changes? for u yes i forgot about gap concept
interpod
interpod•3mo ago
thanks I will try it out and get back to you 😄 one small thing it is react based so I have component called <ItemRow/> which returns <li> for me
MarkBoots
MarkBoots•3mo ago
.items {
display: grid;
grid-template-columns: auto 1fr;
gap: 1rem;
}
.items > * {
grid-column: 1/-1;
display: grid;
grid-template-columns: subgrid;
}
.items {
display: grid;
grid-template-columns: auto 1fr;
gap: 1rem;
}
.items > * {
grid-column: 1/-1;
display: grid;
grid-template-columns: subgrid;
}
b3hold
b3hold•3mo ago
right
interpod
interpod•3mo ago
seems to be working thanks I was wondering if subgrid will be able to work the same for non direct child?
Want results from more Discord servers?
Add your server