Mobile First Strategy
Write base styles for phones, then add min-width queries for larger screens. It keeps CSS lean and works well on slow devices.
Example
<style>
.g { display: grid; gap: 6px } .g div { background: #1e293b; padding: 8px } @media (min-width: 500px) { .g { grid-template-columns: 1fr 1fr } }
</style>
<div class="g"><div>1</div><div>2</div><div>3</div><div>4</div></div>Exercise
Wider than 500px.
@media (-width: 500px)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.