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

Aurelian Spodarec
Aurelian Spodarec
10,801 Points

@at-root (with: media) - Sass

Hi,

.is-displayed-mobile {

  @include mq(small) {
    display: block;

    @at-root (with: media) {
      .is-hidden-mobile {
        display: none;
      }
    }

  }

  @include mq(medium) {
    display: none;
  } 

}

If you look at that, it's all ok but..

@at-root(with: media)

What does that do? I either missed it in the video, Modular Sass somewhere, or i don't get it.

Plus I don't want to watch treehouse vidoes today, since I have lack of :zap: motivaiton :zap: for today, so id just do my project, and look for tips fomr the videos :)

If someone could point me in a right direction pelase

1 Answer

Hi James,

The @at-root directive in SASS will move nested styles out from within a parent selector. I found this great article that provides more detailed examples of the use of @at-root. http://sassbreak.com/getting-back-to-our-roots/

Aurelian Spodarec
Aurelian Spodarec
10,801 Points

They call me Bond, James Bond, never James : p

Thank you! I'll have a read.