用很多断行代码:不在scss中

时间:2019-01-04 09:25:14

标签: css sass

也许这是一个愚蠢的问题,但是我如何才能打破这一行代码(带有很多:not),所以不会那么长:

input {
  &:not(.ant-calendar-input):not(.ant-time-picker-panel-input):not(.ant-calendar-picker-input):not(.ant-time-picker-input) {
    width: 100%;
    height: 100px;
  }

我尝试了这个,但是不起作用:

input {
  &:not(.ant-calendar-input),
  &:not(.ant-time-picker-panel-input),
  &:not(.ant-calendar-picker-input),
  &:not(.ant-time-picker-input) {
    width: 100%;
    height: 100px;
  }

1 个答案:

答案 0 :(得分:1)

您原来的SCSS等同于以下SCSS:

input {
  &:not(.ant-calendar-input) {
    &:not(.ant-time-picker-panel-input) {
      &:not(.ant-calendar-picker-input) {
        &:not(.ant-time-picker-input) {
          width: 100%;
          height: 100px;
        }
      }
    }
  }
}

哪个看起来更像SASS:

input
  &:not(.ant-calendar-input)
    &:not(.ant-time-picker-panel-input)
      &:not(.ant-calendar-picker-input)
        &:not(.ant-time-picker-input)
          width: 100%
          height: 100px