minxin.scss 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. @mixin shadow($xSize,$ySize,$size,$color){//阴影
  2. -moz-box-shadow: $xSize $ySize $size $color !important; /* 老的 Firefox */
  3. box-shadow: $xSize $ySize $size $color !important;
  4. }
  5. @mixin triangle($size,$top-color,$right-color,$bottom-color,$left-color){//三角形
  6. width: 0;
  7. height: 0;
  8. display: block;
  9. border-top: $size solid $top-color;
  10. border-right: $size solid $right-color;
  11. border-bottom: $size solid $bottom-color;
  12. border-left: $size solid $left-color;
  13. }
  14. @mixin translateX($size){//x轴位移
  15. transform:translateX($size);
  16. -webkit-transform:translateX($size);
  17. -moz-transform:translateX($size);
  18. -o-transform:translateX($size);
  19. -ms-transform:translateX($size);
  20. }
  21. @mixin translateY($size){//x轴位移
  22. transform:translateY($size);
  23. -webkit-transform:translateY($size);
  24. -moz-transform:translateY($size);
  25. -o-transform:translateY($size);
  26. -ms-transform:translateY($size);
  27. }
  28. @mixin translate3d($x,$y,$z){//x,y,z轴位移
  29. transform:translate3d($x,$y,$z);
  30. -webkit-transform:translate3d($x,$y,$z);
  31. -moz-transform:translate3d($x,$y,$z);
  32. -o-transform:translate3d($x,$y,$z);
  33. -ms-transform:translate3d($x,$y,$z);
  34. }
  35. @mixin disFlex(){
  36. display: -webkit-flex !important;
  37. display: -moz-flex !important;
  38. display: -ms-flex !important;
  39. display:flex !important;
  40. }
  41. @mixin disBox(){
  42. display:box !important;
  43. display:-webkit-box !important;
  44. }
  45. @mixin disFlex($items: center,$justify: center){//位置
  46. display:flex;
  47. display:-webkit-flex;
  48. align-items: $items;
  49. justify-content: $justify;
  50. }
  51. @mixin box-pack($align,$pack){
  52. display: box;
  53. display: -moz-box;
  54. display: -webkit-box;
  55. box-pack:$pack;
  56. -webkit-box-pack:$pack;
  57. box-align:$align;
  58. -webkit-box-align:$align;
  59. -moz-box-align:$align;
  60. }
  61. @mixin boxDirection(){
  62. -moz-box-pack:end;
  63. -webkit-box-pack:end;
  64. -o-box-pack:end;
  65. box-pack:end;
  66. }
  67. @mixin flex1-1(){
  68. box-flex: 1;
  69. -moz-box-flex:1;
  70. -webkit-box-flex: 1;
  71. flex: 1 !important;
  72. -webkit-flex:1 !important;
  73. }
  74. @mixin transition($type,$time){
  75. -webkit-transition: $type $time; /* Safari 和 Chrome */
  76. -moz-transition: $type $time; /* Firefox 4 */
  77. -o-transition: $type $time;
  78. transition: $type $time;
  79. }
  80. @mixin ransformRotate($deg){//旋转
  81. transform:rotate($deg);
  82. -ms-transform:rotate($deg); /* IE 9 */
  83. -moz-transform:rotate($deg); /* Firefox */
  84. -webkit-transform:rotate($deg); /* Safari 和 Chrome */
  85. -o-transform:rotate($deg); /* Opera */
  86. }
  87. @mixin radius($deg){
  88. border-radius: $deg;
  89. }
  90. @mixin ellipses(){
  91. overflow:hidden;
  92. text-overflow:ellipsis;
  93. -webkit-box-orient:vertical;
  94. }
  95. @mixin urlAbsolute(){
  96. position:absolute;
  97. top:0;
  98. right:0;
  99. bottom:0;
  100. left:0;
  101. }
  102. @mixin box-flex(){
  103. box-flex: 1;
  104. -webkit-box-flex: 1;
  105. -moz-box-flex: 1;
  106. -ms-box-flex: 1;
  107. display: block !important;
  108. width: 100%;
  109. }
  110. @mixin box(){
  111. display: -webkit-box;
  112. display: -moz-box;
  113. display: -ms-box;
  114. display: box;
  115. }
  116. @mixin ell(){
  117. white-space: nowrap;
  118. overflow: hidden;
  119. text-overflow: ellipsis;
  120. }
  121. @mixin boxSizing($val){
  122. box-sizing: $val;
  123. -webkit-box-sizing: $val;
  124. -moz-box-sizing: $val;
  125. -ms-box-sizing: $val;
  126. }
  127. // 背景图片地址和大小
  128. @mixin bis($url) {
  129. background-image: url($url);
  130. background-repeat: no-repeat;
  131. background-size: 100% 100%;
  132. }
  133. @mixin borderRadius($radius) {
  134. -webkit-border-radius: $radius;
  135. -moz-border-radius: $radius;
  136. -ms-border-radius: $radius;
  137. -o-border-radius: $radius;
  138. border-radius: $radius;
  139. }
  140. //定位全屏
  141. @mixin allcover{
  142. position:absolute;
  143. top:0;
  144. right:0;
  145. }
  146. //定位上下左右居中
  147. @mixin center {
  148. position: absolute;
  149. top: 50%;
  150. left: 50%;
  151. transform: translate(-50%, -50%);
  152. }
  153. //定位上下居中
  154. @mixin ct {
  155. position: absolute;
  156. top: 50%;
  157. transform: translateY(-50%);
  158. }
  159. //定位左右居中
  160. @mixin cl {
  161. position: absolute;
  162. left: 50%;
  163. transform: translateX(-50%);
  164. }
  165. //宽高
  166. @mixin wh($width, $height){
  167. width: $width;
  168. height: $height;
  169. }
  170. //字体大小、行高、字体
  171. @mixin font($size, $line-height, $family: 'Microsoft YaHei') {
  172. font: #{$size}/#{$line-height} $family;
  173. }
  174. //字体大小,颜色
  175. @mixin sc($size, $color){
  176. font-size: $size;
  177. color: $color;
  178. }
  179. //flex 布局和 子元素 对其方式
  180. @mixin fj($type: space-between){
  181. display: flex;
  182. justify-content: $type;
  183. }
  184. @mixin disFlexCen(){
  185. display:flex;
  186. display: -webkit-flex;
  187. display: -moz-flex;
  188. display: -ms-flex;
  189. align-items: center;
  190. }