css 波本线性梯度混合的修改版本...由SassMeister.com生成。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 波本线性梯度混合的修改版本...由SassMeister.com生成。相关的知识,希望对你有一定的参考价值。
// ----
// libsass (v3.2.4)
// ----
@import "bourbon/bourbon";
@import "neat/neat";
@mixin linear-gradient2($pos, $g1, $g2: null,
$g3: null, $g4: null,
$g5: null, $g6: null,
$g7: null, $g8: null,
$g9: null, $g10: null,
$fallback: null) {
// Detect what type of value exists in $pos
$pos-type: type-of(nth($pos, 1));
$pos-spec: null;
$pos-degree: null;
// If $pos is missing from mixin, reassign vars and add default position
@if ($pos-type == color) or (nth($pos, 1) == "transparent") {
$g10: $g9; $g9: $g8; $g8: $g7; $g7: $g6; $g6: $g5;
$g5: $g4; $g4: $g3; $g3: $g2; $g2: $g1; $g1: $pos;
$pos: null;
}
@if $pos {
$positions: _linear-positions-parser($pos);
$pos-degree: nth($positions, 1);
$pos-spec: nth($positions, 2);
}
$gradients: $g1, $g2, $g3, $g4, $g5, $g6, $g7, $g8, $g9, $g10;
// Purge null values from list
$full: ();
@each $item in $gradients {
@if ($item) {
$full: append($full, $item);
}
}
$full: zip($full);
// Set $g1 as the default fallback color
$fallback-color: nth($g1, 1);
// If $fallback is a color use that color as the fallback color
@if (type-of($fallback) == color) or ($fallback == "transparent") {
$fallback-color: $fallback;
}
background-color: $fallback-color;
background-image: -webkit-linear-gradient($pos-degree $full); // Safari 5.1+, Chrome
background-image: unquote("linear-gradient(#{$pos-spec}#{$full})");
}
$medium-purple: purple;
$dark-purple: darken(purple, 20%);
.selector{
@include linear-gradient2(to top, $medium-purple, $dark-purple);
}
@function color($val) {
@if type-of($val) == color {
@return $val;
} @else {
@return null
}
}
.block {
color: color(#FFF);
}
html {
box-sizing: border-box;
}
*,
*::after,
*::before {
box-sizing: inherit;
}
.selector {
background-color: purple;
background-image: -webkit-linear-gradient(bottom, purple, #1a001a);
background-image: linear-gradient(to top,purple, #1a001a);
}
.block {
color: #FFF;
}
以上是关于css 波本线性梯度混合的修改版本...由SassMeister.com生成。的主要内容,如果未能解决你的问题,请参考以下文章
Laravel 混合编译 vuetify styles.sass 到空 css 文件
Sass简单使用
Sass Keyframes 动画混合生成无效的 CSS
scss SCSS,SASS,CSS:保证金混合
css 线性梯度
css 背景线性梯度