mixin.scss 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. $blue: #3190e8;
  2. $bc: #e4e4e4;
  3. $fc: #fff;
  4. // 背景图片地址和大小
  5. @mixin bis($url) {
  6. background-image: url($url);
  7. background-repeat: no-repeat;
  8. background-size: 100% 100%;
  9. }
  10. @mixin borderRadius($radius) {
  11. -webkit-border-radius: $radius;
  12. -moz-border-radius: $radius;
  13. -ms-border-radius: $radius;
  14. -o-border-radius: $radius;
  15. border-radius: $radius;
  16. }
  17. //定位全屏
  18. @mixin allcover {
  19. position: absolute;
  20. top: 0;
  21. left: 0;
  22. }
  23. //定位上下左右居中
  24. @mixin center {
  25. position: absolute;
  26. top: 50%;
  27. left: 50%;
  28. transform: translate(-50%, -50%);
  29. }
  30. //定位上下居中
  31. @mixin ct {
  32. position: absolute;
  33. top: 50%;
  34. transform: translateY(-50%);
  35. }
  36. //定位左右居中
  37. @mixin cl {
  38. position: absolute;
  39. left: 50%;
  40. transform: translateX(-50%);
  41. }
  42. //宽高
  43. @mixin wh($width, $height) {
  44. width: $width;
  45. height: $height;
  46. }
  47. //字体大小、行高、字体
  48. @mixin font($size, $line-height, $family: "Microsoft YaHei") {
  49. font: #{$size}/#{$line-height} $family;
  50. }
  51. //字体大小,颜色
  52. @mixin sc($size, $color) {
  53. font-size: $size;
  54. color: $color;
  55. }
  56. //flex 布局和 子元素 对其方式
  57. @mixin fj($type: space-between) {
  58. display: flex;
  59. justify-content: $type;
  60. }