mixins.scss 2.63 KB
// 居中按钮样式
@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;

  -ms-text-overflow: ellipsis;
}

@mixin ellipsis1() {
  display: -webkit-box;
  word-break: break-all;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

// 文字截取
@mixin text-overflow() {
  overflow: hidden;
  white-space: normal;
  text-overflow: ellipsis;
  word-break: break-all;
  word-wrap: normal;
}

@mixin word-break() {
  word-break: break-all;
  word-wrap: break-word;
  white-space: normal;
}

// No wrap
@mixin no-wrap() {
  word-break: normal;
  word-wrap: normal;
  white-space: nowrap;
}

// 清除浮动
@mixin clearfix() {

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

  &:after {
    clear: both;
  }
}

// Single side border-radius
@mixin border-top-radius($radius) {
  border-top-right-radius: $radius;
  border-top-left-radius: $radius;
}

@mixin border-right-radius($radius) {
  border-bottom-right-radius: $radius;
  border-top-right-radius: $radius;
}

@mixin border-bottom-radius($radius) {
  border-bottom-right-radius: $radius;
  border-bottom-left-radius: $radius;
}

@mixin border-left-radius($radius) {
  border-bottom-left-radius: $radius;
  border-top-left-radius: $radius;
}

// Center-align a block level element
@mixin center-block() {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

// CSS image replacement
// Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757
@mixin hide-text() {
  font-size: 0;
  line-height: 0;
  color: transparent;
  text-shadow: none;
  background-color: transparent;
  border: 0;
}


// 居中按钮样式
@mixin btc($width, $height) {
  width: $width;
  height: $height;
  line-height: $height;
  text-align: center;
}



// 通用按钮
@mixin bc($width:100%, $height:88px, $fontSize:30px) {
  color: #FFFFFF;
  position: relative;
  width: $width;
  height: $height;
  line-height: $height;
  text-align: center;
  font-size: $fontSize;
  border-radius: 8px;
  background-color: $colorMain;
}

// 通用按钮
@mixin bc-o($width:100%, $height:88px, $fontSize:30px) {
  position: relative;
  width: $width;
  height: $height;
  line-height: $height;
  text-align: center;
  font-size: $fontSize;
  border-radius: 8px;
  color: $colorMain;
  border: solid 1PX $colorMain;
  background-color: transparent;
}