Re:The Importance of Learning CSS
by sixQuarks on Thursday March 04, 2021 @03:23PM
(#26347750)
Are you sure you know flexbox and grid well? I don’t see how you could prefer floats.
[ Parent
| on HN ]
Grid and flex let you do in five lines what used to take fifty. I'd never go back.
Re:The Importance of Learning CSS
by eurasiantiger on Friday March 05, 2021 @01:52AM
(#26353662)
Thank you for your quadratic-or-worse layout calculations. Then people wonder why the web eats their phone battery.
Re:The Importance of Learning CSS
by eurasiantiger on Friday March 05, 2021 @01:50AM
(#26353653)
They are faster to render especially when resizing the window, and they work in the exact same mental model of layout as everything else in CSS: the box grows to fit its content.
Flexbox and grid do not subscribe to this: flexbox shrinks/grows its content to fit itself. Grid is a configurable beast, something in between, and also makes it possible for grid content (not the container) to define how it itself is laid out.
Floats have their place. The conceptual model is simpler for some simple cases, and you can build layouts that reflow over different viewport sizes without worrying about breakpoints.
Once you need equal-height boxes in your layout, though, it's time to use something else.