Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Andrii-Yukhymenko/76bbb3e0a6eb6f51c4806913064eef64 to your computer and use it in GitHub Desktop.
Save Andrii-Yukhymenko/76bbb3e0a6eb6f51c4806913064eef64 to your computer and use it in GitHub Desktop.
// Пример записи:
// $maxWidth: Ширина КОНТЕЙНЕРА, без px!;
// Пример подключения:
// @include adaptiv-font(Размер текста в макете, размер текста при 320px);
$maxWidth: 1200;
@mixin adaptiv-font($pcSize, $mobSize) {
font-size: #{$pcSize + px};
@media (max-width: #{$maxWidth + px}){
$addSize: $pcSize - $mobSize;
$maxWidth: $maxWidth - 320;
font-size: calc(#{$mobSize + px} + #{$addSize} * ((100vw - 320px) / #{$maxWidth}));
}
}
$maxWidth: 1920;
@mixin adaptiv-font($pcSize, $mobSize) {
$addSize: $pcSize - $mobSize;
$maxWidth: $maxWidth - 320;
font-size: calc(#{$mobSize + px} + #{$addSize} * ((100vw - 320px) / #{$maxWidth}));
}
// Пример записи
// $maxWidth: Ширина макета, без px!;
// @include adaptiv-font(Размер текста в макете, размер текста при 320px);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment