So… an explanation of a very simple concept.
I have a 2x2 layout of an entire page.
1,1 is a box with a defined height, a defined width.
1,2 is a box with a defined height (the other half of the header)
2,1 is a box with a defined width (call it the menu)
and 2,2 is a box unbounded, which should take up the rest of the space.
This grid should fill the whole browser height, stretching the bottom row to the bottom.
I’ve tried numerous ways of laying this out, but i thought “well thats a grid, so try using grid. It’s a learning exercise.”
So here’s what i’ve got. (I’ll have to codepen this when i get home, can’t log in atm. I’m excluding content from the boxes.)
In addition to what @PaulOB said, it’s likely also not helping you’re attempting to declare perfect sizes on everything. Particularly with the broken/inaccessible PX metric. This is 2021, they’re called EM, use 'em!
It’s where people screw up with floats a lot too, declaring widths on all parts and floating all parts instead of just declaring an elastic width on some parts and letting flow and/or fluid sizing handle the rest so they can auto grow/shrink to fit.
Also not sure why you’ve got that extra #root div for nothing, and fixing the height of elements is probably a bad idea as well. Let the content handle your sizing.
Eh. I think in Pixels. Always have, probably always will. My brain doesn’t have a scope for em. Relative sizing based on the parent just… sounds like a recipe for disaster, tbh, as you try and figure out why 1.5em is this big in this div, but that big in another…
It’s a basic React build, the root comes from the ReactDOM.render function call.
In this particular case, this is an application that runs on a single computer, running nothing but this page, in kiosk/fullscreen mode. So i’m not overly concerned about anyone’s view of the page but my own.
Eh. I think in Pixels. Always have, probably always will.
@m_hutley been there done that myself, but since I’ve started using the em, I been loving it, along with using percentages. The more you work with them, the more you get used to it. Useful for RWD . That is, if you want to learn and make websites based on RWD’s.