display:
like-the-iphone-headers
Okay so you may have heard about css layout. or maybe you are normal. Idk. its a new absurdly complex api to lay out css boxes yourself instead of using the browsers layout engine.
The big idea is that for layouts that are _not_ supported by CSS you can use this instead of positioning absolute boxes with javascript and it's more performant because you are going through all this hellish indirection. pretty cool!
Now just to go all recipe website on you, something i do this 2020 to
comfort myself at night instead of crying alone into my pillow (i cant
actually cry its a whole big unrelated deal) is watch youtubes, just
listen to the soothing voice of ppl sppedrun videogames or repair
electronics or make cakes or whatever.
This is unimportant, but something that IS important is youtube itself,
look at this:
The search bar is somewhat center aligned except it's NOT. Compare it to
the address bar in safari which is aligned. Presumably they are using a
flexbox layout and letting the search bar fall on the middle and the
stuff on either side is roughly the same width and honestly? it's good
enough.
Do this in production. But we aren't here for production code, we are
here for the experimental stuff!
Page title on the middle
Hey
Long-ass tools
Try resizing your window and see how this thing wraps! If you need a visual aid I've made this button for you:
Oh yeah if it's all broken you are gonna need to enable the experimental apis, go back to the first link i gave you and actually read that. You should be seeing this:
What's really cool is that if you inspect the code for this page - well
first of all it's a mess and i'm sorry, but second of all, all the
actual layout has to do in the CSS end is use
display: layout(like-the-iphone-headers) and some funky js
takes over from there.
Check it out here! .
Anyway it's awful naive code but I hope this inspires you to find uses for this API! It's really nifty and a step up over laying absolute boxes. And its fun idk. Talk to me about it on Twitter.