grid column/row methods

Hey, is it better to define the size of grid columns/rows by setting either a min-width or min-height (depending on which one), on the parent and using the fr unit, or to define them using set sizes such as 10rem for example? Thanks in advance.
41 Replies
ἔρως
ἔρως8mo ago
if you're using a grid, let the grid do the resizing
snxxwyy
snxxwyyOP8mo ago
So it’s best to use fr units?
b1mind
b1mind8mo ago
REM is not a magic responsive unit only use it when you know you want it to change with a users font size
ἔρως
ἔρως8mo ago
i didn't say that
b1mind
b1mind8mo ago
#depends xD
ἔρως
ἔρως8mo ago
that's a very specific thing wihch may or may not be what you want if you want everything to be the same width or same number of "stops", fr is the easiest but nothing stops you from using percent, pixels, cm, inches, viewport sizes...
snxxwyy
snxxwyyOP8mo ago
Ah so as b1 says, it’s dependent on what you’re trying to do?
ἔρως
ἔρως8mo ago
always does
b1mind
b1mind8mo ago
Yea if you want a general "rule" its let your content determine size. minmax* or min- works in this regard but again #depends.
snxxwyy
snxxwyyOP8mo ago
Ah got it, thank you both
b1mind
b1mind8mo ago
I've been using ch for a max-width for say a "content" area
snxxwyy
snxxwyyOP8mo ago
Yeah that makes sense
b1mind
b1mind8mo ago
Seems to work well without scaling out of control like REM can.
ἔρως
ἔρως8mo ago
it is pretty cool it uses the size of the character 0 for the current font and font-size, to determine it's value
snxxwyy
snxxwyyOP8mo ago
Yeah that is pretty dope
ἔρως
ἔρως8mo ago
it is but i can see it being really useful, specially to contain titles from growing out of control, depending on the layout
snxxwyy
snxxwyyOP8mo ago
just to follow up now i'm on my pc and can get the picture, this layout is what i was basing my question on. i've mapped out the possible grid columns and rows, in this case it's the rows i'm most concerned about. i was wondering in a case like this whether it'd be best to set a min-height on the parent or define the rows with another unit, or as you say, let the content decide the height.
No description
ἔρως
ἔρως8mo ago
ew web 3.0
b1mind
b1mind8mo ago
Web 3.0 is Solid Protocol web3 is scammy shit >.>;;
ἔρως
ἔρως8mo ago
isn't that web3?
b1mind
b1mind8mo ago
no
ἔρως
ἔρως8mo ago
oh, sorry then
b1mind
b1mind8mo ago
its the next version of web Idk what they are doing but just stating
ἔρως
ἔρως8mo ago
i mixed both
b1mind
b1mind8mo ago
Also I'd do it like this
No description
b1mind
b1mind8mo ago
Not as one grid but grids/flexes inside grid
ἔρως
ἔρως8mo ago
i would do the same and then a sub-grid in the 2nd square the big space it could use grid areas for layouting
b1mind
b1mind8mo ago
yea grid area/grid line names are ❤️
ἔρως
ἔρως8mo ago
and makes things stupid easy making stuff responsive becomes a "move the name where you want the element to be"
b1mind
b1mind8mo ago
Kevin Powell
YouTube
A new approach to container and wrapper classes
The wrapper or container is probably the most common design pattern around, but after coming across an article by Stephanie Eckles looking at how we can use a grid to emulate a container, and have simple breakouts — https://smolcss.dev/#smol-breakout-grid — I had an idea of how we could do this to completely drop the idea of containers, and then...
b1mind
b1mind8mo ago
I pointed Kevin to the article for this, its my new fav "wrapper"
snxxwyy
snxxwyyOP8mo ago
is that a better way of doing it or is it more preference?
b1mind
b1mind8mo ago
its always preference xD
snxxwyy
snxxwyyOP8mo ago
true haha
b1mind
b1mind8mo ago
I think its better but others might not agree
snxxwyy
snxxwyyOP8mo ago
what pros does that method have that the other doesn't in your opinion?
b1mind
b1mind8mo ago
You can use sub-grid or inherit too you have lots of power over layout this way imo
snxxwyy
snxxwyyOP8mo ago
ah makes sense
b1mind
b1mind8mo ago
Also clean naming for where it lives You don't need to use viewport units 🤢 to break out of "content" sections. Or be limited to the main wrapper max-width. The other way is to not have a parent wrapper but a utility class(es) that give the minmax/center of each section.
snxxwyy
snxxwyyOP8mo ago
Yeah I do like the grid wrapper
b1mind
b1mind8mo ago
then learn this way for sure.
Want results from more Discord servers?
Add your server