-
-
Save Nikolasgrizli/c19502ab381a67ffc2b5ccfb18e2b5fe to your computer and use it in GitHub Desktop.
Less fx allows you to make a smooth transition in size any properties relative to the width of the screen (if you're using Less 1.6 or later)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.prop-size-fx(@min-size: 1, @max-size: 2, @min-width: 768, @max-width: 1024, @property: font-size){ | |
@{property} : @max-size * 1px; | |
@{property} : ~"calc(@{min-size}px + (@{max-size} - @{min-size}) * ((100vw - @{min-width}px) / (@{max-width} - @{min-width})))"; | |
@media screen and (max-width: (@min-width + 1px)) { | |
@{property} : @min-size * 1px; | |
} | |
@media screen and (min-width: (@max-width + 1px)) { | |
@{property} : @max-size * 1px; | |
} | |
} | |
// example - .prop-size-fx(20,30,768,1024,margin-top); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment