css - 使用 Stylus 的嵌套 CSS 类

标签 css angularjs stylus

我正在尝试使用 AngularJS 制作一些动画,但在尝试使用 Stylus 设置 AngularJS 动画 CSS 类时遇到了问题。我需要最终的 CSS 看起来像这样:

.test-animation-class.ng-hide-remove,
.test-animation-class.ng-hide-add.ng-hide-add-active {
    opacity 0
}

我尝试了以下手写笔:

.test-animation-class
  &.ng-hide-remove
  &.ng-hide-add
    &.ng-hide-add-active
      opacity 0

但结果看起来像这样:

.test-animation-class.ng-hide-remove.ng-hide-add-active,
.test-animation-class.ng-hide-add.ng-hide-add-active {
    opacity 0
}

有没有办法指定 .ng-hide-add-active 类只在直接父 CSS 类 .ng-hide-add 上,而不是 .ng-hide-remove 类?

最佳答案

这行得通吗?

.test-animation-class
  &.ng-hide-remove
  &.ng-hide-add.ng-hide-add-active
    opacity 0

关于css - 使用 Stylus 的嵌套 CSS 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24895002/

相关文章:

javascript - angularJs 形式未正确将对象添加到数组中。 2 路绑定(bind)不起作用

javascript - 使用函数附加和删除 DOM 元素的 AngularJs 指令

javascript - 单个字段上的 Angular $filter

node.js - Stylus ParseError : expected "indent", 得到 "outdent"

css - 在 Stylus 中将列表作为函数参数传递

javascript - 将 google maps InfoWindow 设置为超过 700px 宽度

html - 响应式网站的内容低于固定标题

css - 是否可以将类作为参数传递给 Stylus 中的 mixin?

python - Web2Py:自定义两步验证表单

html - 为什么我的列标题不对齐?