A
A
Anonymous Penguin2022-03-24 23:10:00
Sass
Anonymous Penguin, 2022-03-24 23:10:00

How to add another Transform?

I am using Scss. For one class, I already have a Transform property. For almost the same, but modified, I need to add additional transformations to it. How to do it without using repetition?

<div class="block1">
  <div class="block1__elem block2 block2--mod">
    ...
  </div>
</div>

.block1 {
  &__elem {
    transform: scale(1.1);
  }
}
.block2 {
  &--mod {
    transform: rotate(90deg); //заменяет, а мне нужно использовать вместе с прошлым
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Ankhena, 2022-03-25
@Ankhena

transform: scale(1.1) rotate(90deg);
You can write the old one to a custom property. Then it will automatically change everywhere.

.item {
  --transform: scale(1.1);
  transform: var(--transform);
  
  &--mod {
    transform: var(--transform) rotate(90deg);
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question