Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 ?

Hi,

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 ?

Thanks!

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 ??