Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SASS user-select mixin without import - compass

I'm working on SASS with compass. I've already created some mixins but still, there is one mixin I can't make it to work. That's the user-select one. I know I can import it using @import "compass/css3/user-interface"; but that's not the point. Why my 'handmade' @mixin user-select($value){..} does not seem to work? Is there any known reason?

@mixin user-select($value) {
  -webkit-user-select: $value; 
  -moz-user-select: $value; 
  -ms-user-select: $value; 
  -o-user-select: $value; 
  user-select: $value;    
}

.myclass {
  @include user-select(none);
}
like image 325
Nim Avatar asked Apr 29 '14 09:04

Nim


1 Answers

Seems to work fine for me.. You can try this approach:

@mixin user-select($select) {
  @each $pre in -webkit-, -moz-, -ms-, -o- {
    #{$pre + user-select}: #{$select};
  } 
  #{user-select}: #{$select};
}

.myclass {
  @include user-select(none);
}
like image 91
Ben Kalsky Avatar answered Sep 28 '22 14:09

Ben Kalsky