mixins.scss 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. @mixin arrow($color) {
  2. border: 1px solid $color;
  3. border-right: 0;
  4. border-top: 0;
  5. content: " ";
  6. display: block;
  7. height: 7px;
  8. pointer-events: none;
  9. position: absolute;
  10. transform: rotate(-45deg);
  11. width: 7px;
  12. }
  13. @mixin clearfix {
  14. &:after {
  15. clear: both;
  16. content: " ";
  17. display: table;
  18. }
  19. }
  20. @mixin center($size) {
  21. left: 50%;
  22. margin-left: -($size / 2);
  23. margin-top: -($size / 2);
  24. position: absolute;
  25. top: 50%;
  26. }
  27. @mixin fa($size, $dimensions) {
  28. display: inline-block;
  29. font-size: $size;
  30. height: $dimensions;
  31. line-height: $dimensions;
  32. text-align: center;
  33. vertical-align: top;
  34. width: $dimensions;
  35. }
  36. @mixin overlay($offset: 0) {
  37. bottom: $offset;
  38. left: $offset;
  39. position: absolute;
  40. right: $offset;
  41. top: $offset;
  42. }
  43. @mixin placeholder {
  44. $placeholders: ":-moz" ":-webkit-input" "-moz" "-ms-input";
  45. @each $placeholder in $placeholders {
  46. &:#{$placeholder}-placeholder {
  47. @content;
  48. }
  49. }
  50. }
  51. @mixin replace($background, $width, $height) {
  52. background-color: $background;
  53. background-position: center center;
  54. background-repeat: no-repeat;
  55. background-size: $width $height;
  56. display: block;
  57. height: $height;
  58. outline: none;
  59. overflow: hidden;
  60. text-indent: -290486px;
  61. width: $width;
  62. }
  63. @mixin from($device) {
  64. @media screen and (min-width: $device) {
  65. @content;
  66. }
  67. }
  68. @mixin until($device) {
  69. @media screen and (max-width: $device - 1px) {
  70. @content;
  71. }
  72. }
  73. @mixin mobile {
  74. @media screen and (max-width: $tablet - 1px) {
  75. @content;
  76. }
  77. }
  78. @mixin tablet {
  79. @media screen and (min-width: $tablet) {
  80. @content;
  81. }
  82. }
  83. @mixin tablet-only {
  84. @media screen and (min-width: $tablet) and (max-width: $desktop - 1px) {
  85. @content;
  86. }
  87. }
  88. @mixin touch {
  89. @media screen and (max-width: $desktop - 1px) {
  90. @content;
  91. }
  92. }
  93. @mixin desktop {
  94. @media screen and (min-width: $desktop) {
  95. @content;
  96. }
  97. }
  98. @mixin desktop-only {
  99. @media screen and (min-width: $desktop) and (max-width: $widescreen - 1px) {
  100. @content;
  101. }
  102. }
  103. @mixin widescreen {
  104. @media screen and (min-width: $widescreen) {
  105. @content;
  106. }
  107. }