热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

在SASS/SCSS中拆分变量

如何解决《在SASS/SCSS中拆分变量》经验,为你挑选了1个好方法。

我有一个SASS变量,如下所示:

$surrounding-margin: 0 40px;

我正在使用它(不相关的属性已被删除):

#content {
  margin: $surrounding-margin;

  & #close {
    margin-right: -$surrounding-margin[1]; // If this was JS.
  }
}

显然,-$surrounding-margin[1]不行.会是什么?我需要变量的第二个值,为负数.我怎样才能做到这一点?



1> cyr_x..:

只是用例如nth因为它只是一个列表:

$surrounding-margin: 0 40px;

#content {
  margin: $surrounding-margin;

  & #close {
    margin-right: -(nth($surrounding-margin, 2));
  }
}


推荐阅读
author-avatar
古零零碎碎
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有