_mixins.scss 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // positioning
  2. @mixin inline-block( $vertical-align: middle ) {
  3. display: inline-block;
  4. *display: inline;
  5. *zoom: 1;
  6. vertical-align: $vertical-align;
  7. }
  8. // css triangles
  9. @mixin triangle( $size: 7px, $position: "bottom", $color: #999 ) {
  10. height: 0;
  11. width: 0;
  12. border-style: solid;
  13. border-width: $size;
  14. @if $position == "bottom" {
  15. border-color : transparent transparent $color transparent;
  16. }
  17. @if $position == "top" {
  18. border-color : $color transparent transparent transparent;
  19. }
  20. @if $position == "left" {
  21. border-color : transparent transparent transparent $color;
  22. }
  23. @if $position == "right" {
  24. border-color : transparent $color transparent transparent;
  25. }
  26. }
  27. @mixin dotted-x($position: top) {
  28. background-image: url('../img/dotted-x.png');
  29. background-position: $position;
  30. background-repeat: repeat-x;
  31. }
  32. @mixin dotted-y($position: left) {
  33. background-image: url('../img/dotted-y.png');
  34. background-position: $position;
  35. background-repeat: repeat-y;
  36. }
  37. // css3
  38. @mixin box-sizing( $property: "border-box" ) {
  39. -webkit-box-sizing: $property;
  40. -moz-box-sizing: $property;
  41. box-sizing: $property;
  42. }
  43. @mixin linear-gradient($start-color: #222, $end-color: #000 ) {
  44. background-color: $end-color;
  45. background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from($start-color), to($end-color));
  46. background-image: -webkit-linear-gradient(top, $start-color, $end-color);
  47. background-image: -moz-linear-gradient(top, $start-color, $end-color);
  48. background-image: -ms-linear-gradient(top, $start-color, $end-color);
  49. background-image: -o-linear-gradient(top, $start-color, $end-color);
  50. }
  51. @mixin rounded( $radius: 5px ) {
  52. -moz-border-radius: $radius;
  53. border-radius: $radius;
  54. }
  55. @mixin rounded-side($horizontal, $vertical, $magnitude) {
  56. border-#{$vertical}-#{$horizontal}-radius: $magnitude;
  57. -moz-border-radius-#{$vertical}#{$horizontal}: $magnitude;
  58. -webkit-border-#{$vertical}-#{$horizontal}-radius: $magnitude;
  59. }
  60. @mixin text-shadow($horizontal: 1px, $vertical: 1px, $magnitude: 1px, $color: #888) {
  61. text-shadow: $horizontal $vertical $magnitude $color;
  62. }
  63. @mixin transition($property, $time: 0.25s) {
  64. -webkit-transition: $property $time ease-in-out;
  65. -moz-transition: $property $time ease-in-out;
  66. -o-transition: $property $time ease-in-out;
  67. -ms-transition: $property $time ease-in-out;
  68. transition: $property $time ease-in-out;
  69. }
  70. @mixin inner-shadow($horizontal: 5px, $vertical: 5px, $magnitude: 5px, $color: #888) {
  71. -moz-box-shadow: inset $horizontal $vertical $magnitude $color;
  72. -webkit-box-shadow: inset $horizontal $vertical $magnitude $color;
  73. box-shadow: inset $horizontal $vertical $magnitude $color;
  74. }
  75. @mixin box-shadow($horizontal: 5px, $vertical: 5px, $magnitude: 5px, $color: #888) {
  76. -moz-box-shadow: $horizontal $vertical $magnitude $color;
  77. -webkit-box-shadow: $horizontal $vertical $magnitude $color;
  78. box-shadow: $horizontal $vertical $magnitude $color;
  79. }