Intimidating ground

But starting mobile first is actually easier and will result in less code.

If you build mobile first, you're building up your CSS in complexity.

It turns out that doing that is actually hostile to your users.

You really only want two things: set the width to the device your site is shown on, and make sure the initial scale is 1, which means that 1 pixel in your CSS equals one device-independent pixel, like this: You develop websites on a large laptop or desktop screen, and usually your client is most interested in the desktop design of a website, so it might feel natural to just start with the design for the desktop site and then work your way down.

intimidating ground-82

CSS in new media queries you write will then never influence your earlier sizes.

If you build mobile-first, this means that, as you add styling for larger and larger media queries, you're CSS for just to undo your more advanced desktop styling.

So you're writing more CSS and if you're not carefully undoing all CSS, you end up with things like horizontal overflowing or text not fitting.

Try to style element sizes in relation to their surroundings. If you make use of these layout methods, you'll end up needing less media queries to achieve the same design.

Less media queries means less to reason about, and your code's shorter to boot.

Leave a Reply