/** * ------------------------------------------------------------------ * Sass Minxins * * 参考收集: * https://github.com/twbs/bootstrap-sass/tree/master/assets/stylesheets/bootstrap/mixins * ------------------------------------------------------------------ * */ // 居中按钮样式 @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; } // 文字截取 @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 btc2($wid: 63px, $hei: 30px, $fontSize: 12px) { width: $wid; height: $hei; line-height: $hei; font-size: $fontSize; border-radius: $hei; text-align: center; color: #ffffff; background-color: #f05a23; // 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); box-shadow: 0px 10px 13px 0 rgba(236, 100, 41, 0.2); 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); } @mixin btc3($wid: 63px, $hei: 30px, $fontSize: 12px) { width: $wid; height: $hei; line-height: $hei; font-size: $fontSize; border-radius: $hei; text-align: center; color: #006441; border: solid 1px #006441; } @mixin btc4($wid: 288px, $hei: 60px, $fontSize: 18px) { width: $wid; height: $hei; line-height: $hei; font-size: $fontSize; border-radius: $hei; text-align: center; background-image: linear-gradient(135deg, #f15a08, #feab1b), linear-gradient(90deg, #fff, #fff); color: white; font-weight: 600; cursor: pointer; letter-spacing: 1.4px; } @mixin content-percent($percent: 4%) { box-sizing: border-box; padding: 0 $percent; } @mixin border-tans($borderRadius: 1px, $borderSize: 2px) { border: $borderSize solid transparent; background-clip: padding-box, border-box; background-origin: padding-box, border-box; background-image: linear-gradient(90deg, #fff, #fff), linear-gradient(90deg, #feab1b, #f15a08); border-radius: $borderRadius; } @mixin linear-bg() { background-color: transparent; background-image: linear-gradient(135deg, #f15a08, #feab1b), linear-gradient(90deg, #fff, #fff); } @mixin linear-bg-rev() { background-color: transparent; background-image: linear-gradient(135deg, #feab1b, #f15a08), linear-gradient(90deg, #fff, #fff); }