E
E
evilelf2017-03-19 14:39:12
Sass
evilelf, 2017-03-19 14:39:12

How to get selector properties into a variable in sass/scss?

Hello.
Given:
.demo{ color: red }
How do I get the .demo properties into the $test variable?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Goryachev, 2017-03-19
@webirus

Usually used for these purposes @extend:
https://sass-scss.ru/guide/

.message {
  border: 1px solid #ccc;
  padding: 10px;
  color: #333;
}
.success {
  @extend .message;
  border-color: green;
}
.error {
  @extend .message;
  border-color: red;
}
.warning {
  @extend .message;
  border-color: yellow;
}

A
andead, 2017-03-19
@andead

No way

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question