css - SASS 的多个类名选择器

标签 css sass mixins

我有一个 CSS 代码需要转换为 SASS 以使其更加通用和易于编辑。

我需要实现的是:我有这个选择器:

.responsive .selector,
.responsive-no-touch .selector,
.responsive-android .selector {
     property: value;
}

我如何制作一个 mixin 来定位 .responsive.responsive-no-touch.responsive-android 我只需要编写 .selector 部分?

这行不通:

.responsive, 
.responsive-no-touch, 
.responsive-android {
    .selector {
         property: value;
    }
}

我正在使用 Liferay,这个平台会自动使用 SASS 编译 CSS。

谢谢。

最佳答案

您尝试过以下方法吗?

.responsive, 
.responsive-no-touch, 
.responsive-android {
    &.selector {
         property: value;
    }
}

关于css - SASS 的多个类名选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37052268/

相关文章:

javascript - 使用 Javascript 旋转文本

html - 如何使用 px 回退使 Compass Vertical Rhythm 输出 Rems 而不是 Ems?

html - 具有相同强度定义的较近元素的 CSS 样式选择器的优先级

javascript - CSS 类仅在验证时工作一次

angularjs - CSS 中的渐进定位框分两列

css - 带 ionic 2 的 bootstrap-sass

用于基于类的通用 View 的 Django mixins

Python Mixin - 未解析的属性引用 [PyCharm]

html - 在 bootstrap thumbnail 中创建一个四列的 div

sass - 使用 SASS 连接嵌套类