Skip to content

Instantly share code, notes, and snippets.

@kabilashgit
Created March 20, 2019 12:15
Show Gist options
  • Save kabilashgit/4d5d18f186a728c3b899a1a72e7bdd2b to your computer and use it in GitHub Desktop.
Save kabilashgit/4d5d18f186a728c3b899a1a72e7bdd2b to your computer and use it in GitHub Desktop.
Mixin to add crossbrowser vendor prefix to style property

add crossbrowser property (not for all styles)

mixin

@mixin crossBrowser($property, $val) {
  #{$property}: #{$val};
  -webkit-#{$property}: #{$val};
  -moz-#{$property}: #{$val};
  -ms-#{$property}: #{$val};
  -o-#{$property}: #{$val};
}

usage in scss

.className {
    @include crossBrowser(transition, 4s ease)
}

output in .css

.className {
    transition: all 4s ease;
    -webkit-transition: all 4s ease;
    -moz-transition: all 4s ease;
    -ms-transition: all 4s ease;
    -o-transition: all 4s ease;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment