Skip to Content
Menu

rem()

Convert px units into rem units.

Sass March 19, 2020

Usage

Sass
rem($size)

Parameters

$size
(Required) (size) The size in px
Default: None

Parameter Notes

The size should be written in standard “px” CSS notation such as 18px.

Request or provide clarification »

Examples

Sass
.example {font-size: rem(14px);}

Additional Notes

This function relies on the html element be set to 16px as it calculates the rem size based on 16px.

Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /assets/scss/partials/_functions.scss on line 2.

    Sass
    @function rem($size){
        $remSize: $size/16px; //This relies on the html font-size to be set to 16px
        @return #{$remSize}rem;
    }
    

    Override

    To override or disable this, redefine the mixin/function later on, or use different class names to prevent this from targeting your element.

    Sass
    @mixin rem($size){
        //Write your own code here, leave it blank, or return false.
    }