I am extremely new to Sass/Compass, so this question may sound dumb to many of you.
Anyway, what I need to know is how to create a mixin for browser vendor prefixes that I can reuse over and over without having to type them every time.
I've seen tutorials online but I just can't understand some of the concepts I need to be able to apply them correctly.
What I need right now is to accomplish this in CSS:
* {
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
-ms-box-sizing:border-box;
-o-box-sizing:border-box;
box-sizing:border-box;
}
Thanks.
I also wanted to abstract out vendor prefixes but didn't have compass available to me.
Sass:
Renders:
Also see:
http://stefanwienert.net/blog/2012/05/18/easy-css-vendor-prefix-mixin-for-sass/
Here is my sass solution to deal with vendor prefixes: https://github.com/Aloge/sass-prefixer
It is similiar to @rimian's solution but you only need to include a mixin with the css property and its value and it automatically renders the css with the vendor prefixes necessary. So this:
renders:
but this:
renders:
It's still in beta and it may have bugs but I'm working to improve it and include new features
My Version for single or multiple declarations
Usage for multiple declarations
Usage for single declaration
I think you should use Autoprefixer so you don't have to worry about browser prefixes anymore. Autoprefixer uses the data base of caniuse.com. I recommand you to start using Grunt or Gulp then plugin Autoprefixer as a task it will re-compile the css and spits out needed browser prefixes for you.
Complete Advance Solution
Example of Multiple
Example of Single pref mixin
Finally after compiling using SASS compiler
output
you can download it from here.
*or use grunt build system. *
renders like this: