The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

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 –

    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 but this is for font sizes

    Thanks in advance

    # March 9, 2013 at 10:11 am

    Ok I have figured it out here,

    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.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed