CSS – Where to Place Media Queries in a CSS File

csscss3

Where to put CSS media queries?
Each after the related element class style or pack them at the bottom of the CSS files?
which one is standard? or which one do you prefer?

Best Answer

It mostly depends on your project because at the end of the day it is all about maintenance and adding more stuff to it easily.

So, if you are working on a project which only has a few media queries I would suggest leaving them all in one stylesheet but putting comments on top of it to make it explicit and also easier for you to find it later.

However, if you know you are going to have a lot of properties meticulously defined in your media queries and also have various devices defined then I would suggest separating them out just for readability/maintenance reasons.

Related Topic