News for hackers. Stuff that matters.
Re:Mobile-First CSS: Is It Time for a Rethink? by asddubs on Sunday June 19, 2022 @05:56PM (#31803919)
mobile first css was really useful when stuff like grid wasn't well supported everywhere yet. you could stick stuff in a @supports block, and older browsers just get the mobile view instead, which usually doesn't need grid. But yeah, having done a good bit of both ways, I do think the desktop first way is just easier to write. You would think that "hey things are just stacked on top of one another by default anyway, so mobile default just makes sense", but mobile CSS tends to have a bunch of spacing rules you end up having to undo again, whereas most of the desktop stuff you overwrite is, in my experience, stuff you'd usually have two different rules for no matter what.

Plus, the desktop design tends to be the more complex one, so the HTML will be laid out to accomodate grids/flexbox elements, etc. where necessary. for the mobile view, you usually don't have to change the HTML as much.

There are no comments on this comment yet.