summaryrefslogtreecommitdiff
path: root/_sass/bourbon/functions/_px-to-rem.scss
diff options
context:
space:
mode:
Diffstat (limited to '_sass/bourbon/functions/_px-to-rem.scss')
-rw-r--r--_sass/bourbon/functions/_px-to-rem.scss15
1 files changed, 15 insertions, 0 deletions
diff --git a/_sass/bourbon/functions/_px-to-rem.scss b/_sass/bourbon/functions/_px-to-rem.scss
new file mode 100644
index 0000000..0ac941e
--- /dev/null
+++ b/_sass/bourbon/functions/_px-to-rem.scss
@@ -0,0 +1,15 @@
+// Convert pixels to rems
+// eg. for a relational value of 12px write rem(12)
+// Assumes $em-base is the font-size of <html>
+
+@function rem($pxval) {
+ @if not unitless($pxval) {
+ $pxval: strip-units($pxval);
+ }
+
+ $base: $em-base;
+ @if not unitless($base) {
+ $base: strip-units($base);
+ }
+ @return ($pxval / $base) * 1rem;
+}