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•4mo ago
hi? u cant create it using percentages
interpod
interpodOP•4mo ago
this iw what I would expect
No description
interpod
interpodOP•4mo ago
For wider screens -
damn
damn•4mo ago
imma try
interpod
interpodOP•4mo ago
what you mean percentage?
b3hold
b3hold•4mo ago
grid-template-columns: auto 1fr; doesnt work?
interpod
interpodOP•4mo 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•4mo ago
something like this?
interpod
interpodOP•4mo ago
not exacly, what I am trying is to avid this big gap
damn
damn•4mo ago
oh you can give a min-width like 20% or something
b3hold
b3hold•4mo ago
i think u need to remove width:50% from the items and it would solve the issue the gap issue
b3hold
b3hold•4mo ago
No description
b3hold
b3hold•4mo ago
something like this?
damn
damn•4mo ago
so quick question does the code update if i make changes? for u yes i forgot about gap concept
interpod
interpodOP•4mo 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•4mo 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•4mo ago
right
interpod
interpodOP•4mo 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