Sass negative variable value?

后端 未结 3 448
陌清茗
陌清茗 2020-11-29 02:59

I have a couple of scss selectors where I use the same amount positive and negative, as in:

padding: 0 15px 15px;
margin: 0 -15px 20px -15px;
3条回答
  •  [愿得一人]
    2020-11-29 03:51

    A more sane solution according to sass guidelines would be to interpolate variables like the following example:

    margin: 0 -#{$pad} 20px -#{$pad};
    

    An example: https://www.sassmeister.com/gist/c9c0208ada0eb1fdd63ae47830917293

提交回复
热议问题