Last active
August 29, 2015 14:11
-
-
Save borntorun/f10a94cccd12bb96c19a to your computer and use it in GitHub Desktop.
less mixin to convert px to em/percent step-5
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
#convert-px { | |
.calc(@px; @context; @multiply) { | |
@ret-convert-px:(@px/@context)*@multiply; | |
} | |
.em(@tag; @px; @context) { | |
.calc(@px, @context, 1); | |
.apply(@tag) { | |
@{tag}: @ret-convert-px + 0em; | |
} | |
.apply(@tag); | |
} | |
.percent(@tag; @px; @context) { | |
.calc(@px, @context, 100); | |
.apply(@tag) { | |
@{tag}: @ret-convert-px + 0%; | |
} | |
.apply(@tag); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gist from blog post