_mixins.scss 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. @charset "UTF-8";
  2. @function getButtonColor($color) {
  3. @return if( lightness($color) > 50, #333, #FFF );
  4. }
  5. @function black($opacity){
  6. @return rgba(0,0,0,$opacity);
  7. }
  8. @function white($opacity){
  9. @return rgba(255,255,255,$opacity);
  10. }
  11. @mixin reset{
  12. margin: 0;
  13. padding: 0;
  14. }
  15. @mixin inline-block{
  16. display: inline-block;
  17. *display: inline;
  18. *zoom: 1;
  19. }
  20. @mixin clearfix{
  21. *zoom: 1;
  22. &:before,
  23. &:after{
  24. content: "";
  25. display: table;
  26. line-height: 0;
  27. }
  28. &:after{
  29. clear: both;
  30. }
  31. }
  32. @mixin hide-text{
  33. text-indent: 100%;
  34. white-space: nowrap;
  35. overflow: hidden;
  36. }
  37. @mixin reset-filter {
  38. filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
  39. }
  40. @mixin background-color($value) {
  41. background-color: transparent;
  42. background-color: $value;
  43. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#{ie-hex-str($value)},endColorstr=#{ie-hex-str($value)});
  44. zoom: 1;
  45. }
  46. @mixin break {
  47. -ms-word-break: break-all;
  48. word-break: break-all;
  49. word-break: break-word;
  50. }
  51. @mixin ellipsis {
  52. white-space: nowrap;
  53. word-wrap: normal;
  54. overflow: hidden;
  55. -ms-text-overflow: ellipsis;
  56. -o-text-overflow: ellipsis;
  57. text-overflow: ellipsis;
  58. }
  59. @mixin pre {
  60. white-space: pre-wrap;
  61. white-space: -moz-pre-wrap;
  62. white-space: -pre-wrap;
  63. white-space: -o-pre-wrap;
  64. word-wrap: break-word;
  65. }
  66. @mixin wrap {
  67. text-wrap: wrap;
  68. white-space: pre-wrap;
  69. white-space: -moz-pre-wrap;
  70. word-wrap: break-word;
  71. }
  72. @mixin nowrap {
  73. white-space: nowrap;
  74. word-break: keep-all;
  75. }
  76. @mixin opacity($opacity) {
  77. opacity: $opacity;
  78. /* filter: alpha(opacity=#{$opacity * 100}); */
  79. filter: alpha(opacity= $opacity * 100);
  80. }
  81. @mixin min-height($height) {
  82. min-height: $height;
  83. height: auto !important;
  84. _height: $height;
  85. }
  86. // Gradients 添加渐变过渡函数,20140110 add by petsa
  87. @mixin gradient($color-form, $color-to) {
  88. background: $color-form; // Old browsers
  89. background: -moz-linear-gradient(top, $color-form 0%, $color-to 100%); // FF3.6+
  90. background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,$color-form), color-stop(100%,$color-to)); // Chrome,Safari4+
  91. background: -webkit-linear-gradient(top, $color-form 0%, $color-to 100%); // Chrome10+,Safari5.1+
  92. background: -o-linear-gradient(top, $color-form 0%, $color-to 100%); // Opera 11.10+
  93. background: -ms-linear-gradient(top, $color-form 0%, $color-to 100%); // IE10+
  94. background: linear-gradient(to bottom, $color-form 0%, $color-to 100%); // W3C
  95. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr= $color-form,endColorstr= $color-to,GradientType=0 ); // IE6-9
  96. }
  97. //三角朝上
  98. @mixin triangle-up($width,$color){
  99. width: 0;
  100. height: 0;
  101. border: $width solid $color;
  102. border-color: transparent transparent $color;
  103. }
  104. //三角朝下
  105. @mixin triangle-down($width,$color){
  106. width: 0;
  107. height: 0;
  108. border: $width solid $color;
  109. border-color: $color transparent transparent;
  110. }
  111. //三角朝左
  112. @mixin triangle-left($width,$color){
  113. width: 0;
  114. height: 0;
  115. border: $width solid $color;
  116. border-color: transparent $color transparent transparent;
  117. }
  118. //三角朝右
  119. @mixin triangle-right($width,$color){
  120. width: 0;
  121. height: 0;
  122. border: $width solid $color;
  123. border-color: transparent transparent transparent $color;
  124. }
  125. //左上三角形
  126. @mixin triangle-topleft($width,$color){
  127. width: 0;
  128. height: 0;
  129. border: $width solid $color;
  130. border-color: $color transparent transparent $color;
  131. }
  132. //右上三角形
  133. @mixin triangle-topleft($width,$color){
  134. width: 0;
  135. height: 0;
  136. border: $width solid $color;
  137. border-color: $color $color transparent transparent;
  138. }
  139. //左下三角形
  140. @mixin triangle-bottomleft($width,$color){
  141. width: 0;
  142. height: 0;
  143. border: $width solid $color;
  144. border-color: transparent transparent $color $color;
  145. }
  146. //右下三角形
  147. @mixin triangle-bottomright($width,$color){
  148. width: 0;
  149. height: 0;
  150. border: $width solid $color;
  151. border-color: transparent $color $color transparent;
  152. }