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 Sass Basics Add Reusable Logic to Your Sass Storing Values in Maps

Sarika Rani
Sarika Rani
11,214 Points

is it good to write partial media query for each element or id or class ? or all media should go at one place ?


as i see in the video i learn to write partial media queries... is it a good practise to write partial media queries for each element or we should keep all media at one place ?


1 Answer

David Perkins
David Perkins
9,607 Points

Partial media queries work great for when you're working using a modular styling approach such as BEM. The modular methodology allows you to keep all the styling across all breakpoints in single sheets and within specific selectors for ease of editing.

It's also a very good way of keeping in touch with your styles and creating a logic around where/what is being done at what size/resolution of screen/device.

That being said, there are still occasions where having a mobile-specific stylesheet can be handy but it's not the "best practice" method these days.

I'd stick to partial queries provided that you're logically structuring your stylesheets.

Hope that helps ??