Sass中有多个两类选择器 [英] Multiple two-class selectors in Sass

查看:121
本文介绍了Sass中有多个两类选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

单个声明块具有多个两个类选择器,可以简化以下操作(即不必重复 body 标签):

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;}


推荐答案

尝试一下:

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

这篇关于Sass中有多个两类选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆