Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Basics (2014) Enhancing the Design With CSS Media Query Basics

Sasha Drmic
Sasha Drmic
12,316 Points

Media Queries in separate file vs Media Queries in main.css

In the How to Make a Website course, Nick creates a separate file for MQs > responsive.css. Is that a good idea for bigger projects considering that main.css can contain thousands of lines of code?

3 Answers

Max Weir
Max Weir
14,963 Points

Preferably a scss approach would be ideal, letting you merge all css files into one which can then be compressed for production.

For this course though it would be fine to go with a separate file, but for an actual live site you'd want to keep file requests to a minimum so a single style.css for example is more ideal.

No, you don't have to . You can put all your media query codes in the same file as your other CSS code but just put the media query all the way on the bottom .