Skip to content

Instantly share code, notes, and snippets.

@Nikolasgrizli
Created August 17, 2019 21:46
Show Gist options
  • Save Nikolasgrizli/a8ae0c05cb7f0d73077f2fd36bbf096a to your computer and use it in GitHub Desktop.
Save Nikolasgrizli/a8ae0c05cb7f0d73077f2fd36bbf096a to your computer and use it in GitHub Desktop.
Less fx font-size depends on window screen width
.font-size-fx(@min-size: 15, @max-size: 25, @min-width: 768, @max-width: 1024){
font-size: @max-size * 1px;
font-size: ~"calc(@{min-size}px + (@{max-size} - @{min-size}) * ((100vw - @{min-width}px) / (@{max-width} - @{min-width})))";
@media screen and (max-width: (@min-width + 1px)) {
font-size: @min-size * 1px;
}
@media screen and (min-width: (@max-width + 1px)) {
font-size: @max-size * 1px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment