Grow your CSS skills. Land your dream job.

Create REM fallback in a mixin – SCSS

  • # March 9, 2013 at 10:03 am

    Hi guys,

    I have recently started using SASS and pretty new to writing mixins.

    I am trying to create some generic classes and would like to use REM units, but also providing a pixel fallback.

    Here is a codepen – http://codepen.io/anon/pen/ulopB

    As you can see I have set the main value as a variable, and am using this variable in the classes, but this is only outputting REM, how can I output so there is a pixel fallback using a mixin?

    I have seen this article https://gist.github.com/drublic/4374738 but this is for font sizes

    Thanks in advance

    # March 9, 2013 at 10:11 am

    Ok I have figured it out here, http://codepen.io/anon/pen/mlsuh

    Feel free to comment if there is a more efficient way to to do this.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".