_gradients.scss 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Gradients
  2. // Horizontal gradient, from left to right
  3. //
  4. // Creates two color stops, start and end, by specifying a color and position for each color stop.
  5. // Color stops are not available in IE9 and below.
  6. @mixin gradient-horizontal($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) {
  7. background-image: -webkit-linear-gradient(left, $start-color $start-percent, $end-color $end-percent); // Safari 5.1-6, Chrome 10+
  8. background-image: -o-linear-gradient(left, $start-color $start-percent, $end-color $end-percent); // Opera 12
  9. background-image: linear-gradient(to right, $start-color $start-percent, $end-color $end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+
  10. background-repeat: repeat-x;
  11. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=1); // IE9 and down
  12. }
  13. // Vertical gradient, from top to bottom
  14. //
  15. // Creates two color stops, start and end, by specifying a color and position for each color stop.
  16. // Color stops are not available in IE9 and below.
  17. @mixin gradient-vertical($start-color: #555, $end-color: #333, $start-percent: 0%, $end-percent: 100%) {
  18. background-image: -webkit-linear-gradient(top, $start-color $start-percent, $end-color $end-percent); // Safari 5.1-6, Chrome 10+
  19. background-image: -o-linear-gradient(top, $start-color $start-percent, $end-color $end-percent); // Opera 12
  20. background-image: linear-gradient(to bottom, $start-color $start-percent, $end-color $end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+
  21. background-repeat: repeat-x;
  22. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=0); // IE9 and down
  23. }
  24. @mixin gradient-directional($start-color: #555, $end-color: #333, $deg: 45deg) {
  25. background-repeat: repeat-x;
  26. background-image: -webkit-linear-gradient($deg, $start-color, $end-color); // Safari 5.1-6, Chrome 10+
  27. background-image: -o-linear-gradient($deg, $start-color, $end-color); // Opera 12
  28. background-image: linear-gradient($deg, $start-color, $end-color); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+
  29. }
  30. @mixin gradient-horizontal-three-colors($start-color: #00b3ee, $mid-color: #7a43b6, $color-stop: 50%, $end-color: #c3325f) {
  31. background-image: -webkit-linear-gradient(left, $start-color, $mid-color $color-stop, $end-color);
  32. background-image: -o-linear-gradient(left, $start-color, $mid-color $color-stop, $end-color);
  33. background-image: linear-gradient(to right, $start-color, $mid-color $color-stop, $end-color);
  34. background-repeat: no-repeat;
  35. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=1); // IE9 and down, gets no color-stop at all for proper fallback
  36. }
  37. @mixin gradient-vertical-three-colors($start-color: #00b3ee, $mid-color: #7a43b6, $color-stop: 50%, $end-color: #c3325f) {
  38. background-image: -webkit-linear-gradient($start-color, $mid-color $color-stop, $end-color);
  39. background-image: -o-linear-gradient($start-color, $mid-color $color-stop, $end-color);
  40. background-image: linear-gradient($start-color, $mid-color $color-stop, $end-color);
  41. background-repeat: no-repeat;
  42. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start-color)}', endColorstr='#{ie-hex-str($end-color)}', GradientType=0); // IE9 and down, gets no color-stop at all for proper fallback
  43. }
  44. @mixin gradient-radial($inner-color: #555, $outer-color: #333) {
  45. background-image: -webkit-radial-gradient(circle, $inner-color, $outer-color);
  46. background-image: radial-gradient(circle, $inner-color, $outer-color);
  47. background-repeat: no-repeat;
  48. }
  49. @mixin gradient-striped($color: rgba(255,255,255,.15), $angle: 45deg) {
  50. background-image: -webkit-linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
  51. background-image: -o-linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
  52. background-image: linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
  53. }