【CSS】关于在 sass 中使用 calc 不能包含变量的问题

关于在 sass 中使用 calc 不能包含变量的问题

在 sass 中使用 calc,如果 calc 中包含一个变量,不会产生效果

$sideBarWidth = 200px;
.navbar {
  width: calc(100% - $sideBarWidth);
}

如何解决呢? 要想在 calc 中使用变量,必须对这个变量使用 sass 的插值方法(#{$variable})

.navbar {
  width: calc(100% - #{$sideBarWidth});
}
posted @ 2021-02-10 14:01  [ABing]  阅读(220)  评论(0编辑  收藏  举报