Multiple two-class selectors in Sass

Fellow Stranger picture Fellow Stranger · Sep 1, 2013 · Viewed 61.7k times · Source

Having multiple two-class selectors for a single declaration block, is it possible to simplify the following (i.e. not having to repeat the body tag):

body.shop, body.contact, body.about, body.faq {background-color:#fff;}

Answer

Alessandro Minoccheri picture Alessandro Minoccheri · Sep 1, 2013

try this:

body{
   &.shop, &.contact, &.about, &.faq {
        background-color:#fff;
    }
}