DEV Community

Discussion on: Do you code mobile-first?

Collapse
 
nicm42 profile image
Nic

I personally don't think it matters as long as it works in the end. That's all the users care about it.

I used to do desktop-first because I looked at it on a computer first. But then I did a tutorial that pointed out the efficiency of mobile first and now I do that.

By efficiency I mean that on mobile you're generally going to have everything below each other. It's only when you go to desktop that you might want things next to each other and then you add a bit of flexbox or grid.

So your general would need nothing and your desktop CSS media query would need display: flex. But doing it the other way round, your general CSS would need display: flex, then your mobile media-query would need flex-direction: column.

Not that it's perfect. I find it's easier to to put things next to each other and then see at what point they don't fit, rather than put them below each other and estimate at what point they'll fit next to each other.