_mixins.scss 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /******************************************************************
  2. Site Name:
  3. Author:
  4. Stylesheet: Mixins Stylesheet
  5. This is where you can take advantage of Sass' great features: Mixins.
  6. I won't go in-depth on how they work exactly,
  7. there are a few articles below that will help do that. What I will
  8. tell you is that this will help speed up simple changes like
  9. changing a color or adding CSS3 techniques gradients.
  10. A WORD OF WARNING: It's very easy to overdo it here. Be careful and
  11. remember less is more.
  12. Helpful:
  13. http://sachagreif.com/useful-sass-mixins/
  14. http://thesassway.com/intermediate/leveraging-sass-mixins-for-cleaner-code
  15. http://web-design-weekly.com/blog/2013/05/12/handy-sass-mixins/
  16. ******************************************************************/
  17. /*********************
  18. TRANSITION
  19. *********************/
  20. /*
  21. I totally rewrote this to be cleaner and easier to use.
  22. You'll need to be using Sass 3.2+ for these to work.
  23. Thanks to @anthonyshort for the inspiration on these.
  24. USAGE: @include transition(all 0.2s ease-in-out);
  25. */
  26. @mixin transition($transition...) {
  27. // defining prefixes so we can use them in mixins below
  28. $prefixes: ("-webkit-", "" );
  29. @each $prefix in $prefixes {
  30. #{$prefix}transition: $transition;
  31. }
  32. }
  33. /*********************
  34. CSS3 GRADIENTS
  35. Be careful with these since they can
  36. really slow down your CSS. Don't overdo it.
  37. *********************/
  38. /* @include css-gradient(#dfdfdf,#f8f8f8); */
  39. @mixin css-gradient($from: #dfdfdf, $to: #f8f8f8) {
  40. background-color: $to;
  41. background-image: -webkit-gradient(linear, left top, left bottom, from($from), to($to));
  42. background-image: -webkit-linear-gradient(top, $from, $to);
  43. background-image: -moz-linear-gradient(top, $from, $to);
  44. background-image: -o-linear-gradient(top, $from, $to);
  45. background-image: linear-gradient(to bottom, $from, $to);
  46. }
  47. /*********************
  48. BOX SIZING
  49. *********************/
  50. /* @include box-sizing(border-box); */
  51. /* NOTE: value of "padding-box" is only supported in Gecko. So
  52. probably best not to use it. I mean, were you going to anyway? */
  53. @mixin box-sizing($type: border-box) {
  54. -webkit-box-sizing: $type;
  55. -moz-box-sizing: $type;
  56. -ms-box-sizing: $type;
  57. box-sizing: $type;
  58. }