M
M
make_dev2016-02-03 18:18:34
Sass
make_dev, 2016-02-03 18:18:34

Using Sass Variables in Media Queries?

Good afternoon! Mastering Sass? and the following question arose.
Is it possible to use Sass variables next. way: first, in the main style file, I specify one variable value, for example, padding. And then in Media-queries for each resolution I change the variable to the desired value?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Nemiro, 2016-02-03
@make_dev

Yes, you can:

$padding: 8px;

div {
  padding: $padding; // 8px
}


@media (min-width: $screen-tablet) {
  $padding: 4px;

  div {
    padding: $padding; // 4px
  }
}

The main thing is not to get confused :-)
Perhaps the best solution would be not to change the original value, but to perform calculations:
$padding: 8px;

div {
  padding: $padding; // 8px
}


@media (min-width: $screen-tablet) {
  div {
    padding: ($padding - 4); // 8 - 4 = 4px
  }
}

P
Pavel Solovyov, 2014-09-22
@pavel_salauyou

any modern framework: Yii2, Symfony2, Laravel, Phalcon, Rails, Django, etc. meets these requirements

V
Vitaly, 2018-10-24
@vshvydky

hello typescript
decorated express https://github.com/typeorm/typeorm-routing-control...
dependency injection https://github.com/typeorm/typeorm-typedi-extensions
ORM (there are different models. there are cascades, you take the cascading model with relays, update everything you need, say save, it transactionally writes your edits) https://github.com/typeorm/typeorm
authorization via jwt atsl
overlay can be solved through decorators or sails.js
middleware don't use it, it's a corpse

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question