DEV Community

Discussion on: CSS media query : how to make website responsive

Collapse
 
violet profile image
Elena

You don't need the @media (max-width: 600px) {...} part, because your non responsive code should work everywhere. Then starting from the @media (min-width: 600px) {...} and up, you apply changes to your base code for each specific break point, where you overwrite certain parts.

Collapse
 
themodernweb profile image
Modern Web

Yes but I didn't said you need all of these, these are just some common breakpoints.

Collapse
 
violet profile image
Elena

Indeed, depending on where you start you might have for desktop first:

  • @media (max-width: 1200px)
  • @media (max-width: 992px)
  • @media (max-width: 768px)
  • @media (max-width: 576px)

while for mobile first you can have:

  • @media (min-width: 576px)
  • @media (min-width: 768px)
  • @media (min-width: 992px)
  • @media (min-width: 1200px)
Thread Thread
 
themodernweb profile image
Modern Web

Yes, I agree. Well what you prefer mobile first or desktop first. I prefer desktop first btw.😅😅

Thread Thread
 
chadrackkyungu profile image
Chadrack kyungu

I prefer mobile first coz it makes ur life easier and reduces repetition of styles

Some comments have been hidden by the post's author - find out more