Blame view

src/styles/_mixins.scss 3.36 KB
simon committed
1 2 3 4 5 6 7 8 9 10
/**
 * ------------------------------------------------------------------
 * Sass Minxins
 *
 * 参考收集:
 * https://github.com/twbs/bootstrap-sass/tree/master/assets/stylesheets/bootstrap/mixins
 * ------------------------------------------------------------------
 *
 */

simon committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
// 居中按钮样式
@mixin btn-center($width, $height) {
  width: $width;
  height: $height;
  line-height: $height;
  text-align: center;
}

// 超过多少行自动省略 默认一行
@mixin ellipsis($line:1) {
  display: -webkit-box;
  word-break: break-all;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: $line;
  overflow: hidden;
  text-overflow: ellipsis;
}

simon committed
29 30
// 文字截取
@mixin text-overflow() {
simon committed
31 32 33 34 35
  overflow: hidden;
  white-space: normal;
  text-overflow: ellipsis;
  word-break: break-all;
  word-wrap: normal;
simon committed
36 37 38
}

@mixin word-break() {
simon committed
39 40 41
  word-break: break-all;
  word-wrap: break-word;
  white-space: normal;
simon committed
42 43 44 45
}

// No wrap
@mixin no-wrap() {
simon committed
46 47 48
  word-break: normal;
  word-wrap: normal;
  white-space: nowrap;
simon committed
49 50 51 52
}

// 清除浮动
@mixin clearfix() {
simon committed
53 54 55 56 57 58 59 60 61 62

  &:before,
  &:after {
    content: " "; // 1
    display: table; // 2
  }

  &:after {
    clear: both;
  }
simon committed
63 64 65 66
}

// Single side border-radius
@mixin border-top-radius($radius) {
simon committed
67 68
  border-top-right-radius: $radius;
  border-top-left-radius: $radius;
simon committed
69 70 71
}

@mixin border-right-radius($radius) {
simon committed
72 73
  border-bottom-right-radius: $radius;
  border-top-right-radius: $radius;
simon committed
74 75 76
}

@mixin border-bottom-radius($radius) {
simon committed
77 78
  border-bottom-right-radius: $radius;
  border-bottom-left-radius: $radius;
simon committed
79 80 81
}

@mixin border-left-radius($radius) {
simon committed
82 83
  border-bottom-left-radius: $radius;
  border-top-left-radius: $radius;
simon committed
84 85 86 87
}

// Center-align a block level element
@mixin center-block() {
simon committed
88 89 90
  display: block;
  margin-left: auto;
  margin-right: auto;
simon committed
91 92 93 94 95
}

// CSS image replacement
// Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757
@mixin hide-text() {
simon committed
96 97 98 99 100 101 102 103
  font-size: 0;
  line-height: 0;
  color: transparent;
  text-shadow: none;
  background-color: transparent;
  border: 0;
}

2  
simon committed
104

simon committed
105 106 107 108 109 110 111 112 113 114
// 橙色按钮
@mixin btc2($wid:5.25rem, $hei:2.5rem, $fontSize:12px) {
  width: $wid;
  height: $hei;
  line-height: $hei;
  font-size: $fontSize;
  border-radius: $hei;
  text-align: center;
  color: #ffffff;
  background-color: #f05a23;
simon committed
115 116 117
  // box-shadow: 0px 10px 13px 0 rgba(236, 100, 41, 0.2);
  // background-blend-mode: soft-light, ;
  // background-image: linear-gradient(to bottom, #f05f28, #f05021);
simon committed
118
  box-shadow: 0px 10px 13px 0 rgba(236, 100, 41, 0.2);
simon committed
119 120 121 122
  background-blend-mode: soft-light;
  background-image: linear-gradient(to bottom, #ec6429, #ec6429), linear-gradient(to top, #000000, #ffffff);
  // background-image: linear-gradient(to top, #000000, #ffffff), linear-gradient(to bottom, #ec6429, #ec6429);

simon committed
123
}
2  
simon committed
124 125 126 127 128 129 130 131 132 133 134 135


@mixin btc3($wid:5.25rem, $hei:2.5rem, $fontSize:12px) {
  width: $wid;
  height: $hei;
  line-height: $hei;
  font-size: $fontSize;
  border-radius: $hei;
  text-align: center;
  color: #006441;
  border: solid 1px #006441;
}
simon committed
136

simon committed
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
@mixin btc4($wid:24rem, $hei:5rem, $fontSize:12px) {
  width: $wid;
  height: $hei;
  line-height: $hei;
  font-size: $fontSize;
  border-radius: $hei;
  text-align: center;

  background: url("~@assets/images/vhis/vhis-btn.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  color: white;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 1.4px;
}


simon committed
155 156 157 158
@mixin content-percent($percent:4%) {
  box-sizing: border-box;
  padding: 0 $percent;
}