vendredi 23 juin 2017

Split variables in SASS / SCSS

I have a SASS variable like the following:

$surrounding-margin: 0 40px;

And I'm using it like this (the irrelevant properties have been removed):

#content {
  margin: $surrounding-margin;

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

Obviously, -$surrounding-margin[1] won't work. What will? I need the second value of the variable, in the negative. How can I do this?




Aucun commentaire:

Enregistrer un commentaire