What is it?
With the SCSS mixin “Responsive property”
you can set up an automatic change of any CSS property value that has a numeric value
(for example: font-size, padding, gap, etc.).
Using the mixin
Inside an SCSS selector, call it (usually via the av snippet):
@include adaptiveValue("property", start, end);
- property — the CSS property (as a string) you want to make responsive.
- start — the starting value (number only, without
px). - end — the ending value (number only, without
px).
Examples:
@include adaptiveValue("font-size", 50, 20);
@include adaptiveValue("padding-top", 80, 10);
@include adaptiveValue("gap", 24, 12);
How it works
The mixin works based on variables from src/styles/settings.scss:
$minWidth, $maxWidth, $maxWidthContainer,
$containerPadding and $containerWidth.
$maxWidthContainer > 0 — scaling happens between $containerWidth
and $minWidth.If
$maxWidthContainer = 0 — scaling happens between $maxWidth and
$minWidth.
- Wider than the “from” width — the value equals the start value.
- Below
$minWidth— the value equals the end value.
Modes
You can configure the behavior outside the range by specifying a mode:
@include adaptiveValue("property", start, end, mode);
mode can be 0 (or omitted), 1, 2,
3:
0 (or omitted)
Wider than “from” — start, below “to” — end.
1
Works only inside the range (or the default range). Outside it — the default value / inheritance applies.
2
Wider than “from” — start, below “to” — default value / inheritance.
3
Wider than “from” — default value / inheritance, below “to” — end.
@include adaptiveValue("font-size", 50, 20, 1);
Custom width ranges
You can define your own width range where scaling happens:
@include adaptiveValue("property", start, end, mode, widthFrom, widthTo);
widthFrom— the width below which scaling starts (number only, withoutpx).widthTo— the width down to which scaling continues (number only, withoutpx).
@include adaptiveValue("font-size", 50, 20, 0, 800, 480);
You can also make multiple calls with different ranges:
@include adaptiveValue("font-size", 50, 20, 2, 800, 480);
@include adaptiveValue("font-size", 20, 10, 3, 480, 320);
Where is the mixin located?
The adaptiveValue mixin is located in:
src/styles/includes/mixins.scss
Download
Want the same responsive approach without extra media queries?
Download the template and start using adaptiveValue in your projects right away.