新主题

This commit is contained in:
结发受长生
2018-06-06 17:33:48 +08:00
parent de8e1887a6
commit c77caf259f
106 changed files with 28656 additions and 7 deletions
@@ -0,0 +1,378 @@
@charset "UTF-8";
//-----------------------------------------------------
// animate.scss
// 提供6组动画 fade-in/out, shrink-in/out, up-in/out, down-in/out, left-in/out, right-in/out
//-----------------------------------------------------
%animation-basic {
animation-duration: 0.3s;
animation-fill-mode: both;
}
// fade in/out
//-----------------------------------------------------
@mixin animation-fade-in($className: fade, $from: 0) {
$name: str-insert(In, $className, 0);
.#{$className}-in {
animation-name: $name;
@extend %animation-basic;
}
@include animation-fade($name: $name, $from: $from);
}
@mixin animation-fade-out($className: fade, $to: 0) {
$name: str-insert(Out, $className, 0);
.#{$className}-out {
animation-name: $name;
@extend %animation-basic;
}
@include animation-fade($name: $name, $from: 1, $to: $to);
}
// shrink in/out
//-----------------------------------------------------
@mixin animation-shrink-in($className: shrink, $from: 0.815) {
$name: str-insert(In, $className, 0);
.#{$className}-in {
animation-name: $name;
@extend %animation-basic;
}
@keyframes #{$name} {
0% {
opacity: 0;
transform: scale($from);
}
100% {
opacity: 1;
transform: scale(1);
}
}
}
@mixin animation-shrink-out($className: shrink, $to: 1.185) {
$name: str-insert(Out, $className, 0);
.#{$className}-out {
animation-name: $name;
@extend %animation-basic;
}
@keyframes #{$name} {
0% {
opacity: 1;
transform: scale(1);
}
100% {
opacity: 0;
transform: scale($to);
}
}
}
// down in/out
//-----------------------------------------------------
@mixin animation-down-in($className: down, $value: 100%) {
$name: str-insert(In, $className, 0);
.#{$className}-in {
animation-name: $name;
@extend %animation-basic;
}
@keyframes #{$name} {
0% {
opacity: 0;
transform: translate(0, $value);
}
100% {
opacity: 1;
transform: translate(0, 0);
}
}
}
@mixin animation-down-out($className: down, $value: 100%) {
$name: str-insert(Out, $className, 0);
.#{$className}-out {
animation-name: $name;
@extend %animation-basic;
}
@keyframes #{$name} {
0% {
opacity: 1;
transform: translate(0, 0);
}
100% {
opacity: 0;
transform: translate(0, $value);
}
}
}
// up in/out
//-----------------------------------------------------
@mixin animation-up-in($className: up, $value: -100%) {
$name: str-insert(In, $className, 0);
.#{$className}-in {
animation-name: $name;
@extend %animation-basic;
}
@keyframes #{$name} {
0% {
opacity: 0;
transform: translate(0, $value);
}
100% {
opacity: 1;
transform: translate(0, 0);
}
}
}
@mixin animation-up-out($className: up, $value: -100%) {
$name: str-insert(Out, $className, 0);
.#{$className}-out {
animation-name: $name;
@extend %animation-basic;
}
@keyframes #{$name} {
0% {
opacity: 1;
transform: translate(0, 0);
}
100% {
opacity: 0;
transform: translate(0, $value);
}
}
}
// left in/out
//-----------------------------------------------------
@mixin animation-left-in($className: left, $value: -100%) {
$name: str-insert(In, $className, 0);
.#{$className}-in {
animation-name: $name;
@extend %animation-basic;
}
@keyframes #{$name} {
0% {
opacity: 0;
transform: translate($value, 0);
}
100% {
opacity: 1;
transform: translate(0, 0);
}
}
}
@mixin animation-left-out($className: left, $value: -100%) {
$name: str-insert(Out, $className, 0);
.#{$className}-out {
animation-name: $name;
@extend %animation-basic;
}
@keyframes #{$name} {
0% {
opacity: 1;
transform: translate(0, 0);
}
100% {
opacity: 0;
transform: translate($value, 0);
}
}
}
// right in/out
//-----------------------------------------------------
@mixin animation-right-in($className: right, $value: 100%) {
$name: str-insert(In, $className, 0);
.#{$className}-in {
animation-name: $name;
@extend %animation-basic;
}
@keyframes #{$name} {
0% {
opacity: 0;
transform: translate($value, 0);
}
100% {
opacity: 1;
transform: translate(0, 0);
}
}
}
@mixin animation-right-out($className: right, $value: 100%) {
$name: str-insert(Out, $className, 0);
.#{$className}-out {
animation-name: $name;
@extend %animation-basic;
}
@keyframes #{$name} {
0% {
opacity: 1;
transform: translate(0, 0);
}
100% {
opacity: 0;
transform: translate($value, 0);
}
}
}
/*弹性动画*/
@keyframes leftIn {
from, 60%, 75%, 90%, to {
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
transform: translate3d(0, 0, 0);
}
60% {
transform: translate3d(358px, 0, 0);
}
75% {
transform: translate3d(323px, 0, 0);
}
90% {
transform: translate3d(338px, 0, 0);
}
to {
transform: translate3d(333px, 0, 0);
}
}
%anmLeftIn {
animation-duration: .8s;
animation-fill-mode: both;
animation-name: leftIn;
}
@keyframes leftOut {
from, 60%, 75%, 90%, to {
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
transform: translate3d(333px, 0, 0);
}
60% {
transform: translate3d(-25px, 0, 0);
}
75% {
transform: translate3d(10px, 0, 0);
}
90% {
transform: translate3d(-5px, 0, 0);
}
to {
transform: translate3d(0, 0, 0);
}
}
%anmLeftOut {
animation-duration: .8s;
animation-name: leftOut;
}
@keyframes smallLeftIn {
from, 60%, 75%, 90%, to {
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
transform: translate3d(0, 0, 0);
}
60% {
transform: translate3d(325px, 0, 0);
}
75% {
transform: translate3d(290px, 0, 0);
}
90% {
transform: translate3d(305px, 0, 0);
}
to {
transform: translate3d(300px, 0, 0);
}
}
%anmSmallLeftIn {
animation-duration: .8s;
animation-fill-mode: both;
animation-name: smallLeftIn;
}
@keyframes smallleftOut {
from, 60%, 75%, 90%, to {
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
0% {
transform: translate3d(333px, 0, 0);
}
60% {
transform: translate3d(-25px, 0, 0);
}
75% {
transform: translate3d(10px, 0, 0);
}
90% {
transform: translate3d(-5px, 0, 0);
}
to {
transform: translate3d(0, 0, 0);
}
}
%anmSmallLeftOut {
animation-duration: .8s;
animation-fill-mode: both;
animation-name: smallleftOut;
}
@@ -0,0 +1,247 @@
@charset "utf-8";
//-----------------------------------------------------
// media queries scss
// author: Rafal Bromirski
// github: http://github.com/paranoida/sass-mediaqueries
// version: 1.6.1
//-----------------------------------------------------
// generator
// ----------------------------------------------------
@mixin mq($args...) {
$media-type: 'only screen';
$media-type-key: 'media-type';
$args: keywords($args);
$expr: '';
@if map-has-key($args, $media-type-key) {
$media-type: map-get($args, $media-type-key);
$args: map-remove($args, $media-type-key);
}
@each $key, $value in $args {
@if $value {
$expr: "#{$expr} and (#{$key}: #{$value})";
}
}
@media #{$media-type} #{$expr} {
@content;
}
}
// screen
// ----------------------------------------------------
@mixin screen($min, $max, $orientation: false) {
@include mq($min-width: $min, $max-width: $max, $orientation: $orientation) {
@content;
}
}
@mixin max-screen($max) {
@include mq($max-width: $max) {
@content;
}
}
@mixin min-screen($min) {
@include mq($min-width: $min) {
@content;
}
}
@mixin screen-height($min, $max, $orientation: false) {
@include mq($min-height: $min, $max-height: $max, $orientation: $orientation) {
@content;
}
}
@mixin max-screen-height($max) {
@include mq($max-height: $max) {
@content;
}
}
@mixin min-screen-height($min) {
@include mq($min-height: $min) {
@content;
}
}
// hdpi
// ----------------------------------------------------
@mixin hdpi($ratio: 1.3) {
@media only screen and (-webkit-min-device-pixel-ratio: $ratio),
screen and (min-resolution: #{round($ratio*96)}dpi) {
@content;
}
}
// hdtv
// ----------------------------------------------------
@mixin hdtv($standard: '1080') {
$min-width: false;
$min-height: false;
$standards: ('720p', 1280px, 720px)
('1080', 1920px, 1080px)
('2K', 2048px, 1080px)
('4K', 4096px, 2160px);
@each $s in $standards {
@if $standard == nth($s, 1) {
$min-width: nth($s, 2);
$min-height: nth($s, 3);
}
}
@include mq(
$min-device-width: $min-width,
$min-device-height: $min-height,
$min-width: $min-width,
$min-height: $min-height
) {
@content;
}
}
// iphone 4
// ----------------------------------------------------
@mixin iphone4($orientation: false) {
$min: 320px;
$max: 480px;
$pixel-ratio: 2;
$aspect-ratio: '2/3';
@include mq(
$min-device-width: $min,
$max-device-width: $max,
$orientation: $orientation,
$device-aspect-ratio: $aspect-ratio,
$-webkit-device-pixel-ratio: $pixel-ratio
) {
@content;
}
}
// iphone 5
// ----------------------------------------------------
@mixin iphone5($orientation: false) {
$min: 320px;
$max: 568px;
$pixel-ratio: 2;
$aspect-ratio: '40/71';
@include mq(
$min-device-width: $min,
$max-device-width: $max,
$orientation: $orientation,
$device-aspect-ratio: $aspect-ratio,
$-webkit-device-pixel-ratio: $pixel-ratio
) {
@content;
}
}
// iphone 6
// ----------------------------------------------------
@mixin iphone6($orientation: false) {
$min: 375px;
$max: 667px;
$pixel-ratio: 2;
@include mq(
$min-device-width: $min,
$max-device-width: $max,
$orientation: $orientation,
$-webkit-device-pixel-ratio: $pixel-ratio
) {
@content;
}
}
// iphone 6 plus
// ----------------------------------------------------
@mixin iphone6-plus($orientation: false) {
$min: 414px;
$max: 736px;
$pixel-ratio: 3;
@include mq(
$min-device-width: $min,
$max-device-width: $max,
$orientation: $orientation,
$-webkit-device-pixel-ratio: $pixel-ratio
) {
@content;
}
}
// ipad (all)
// ----------------------------------------------------
@mixin ipad($orientation: false) {
$min: 768px;
$max: 1024px;
@include mq(
$min-device-width: $min,
$max-device-width: $max,
$orientation: $orientation
) {
@content;
}
}
// ipad-retina
// ----------------------------------------------------
@mixin ipad-retina($orientation: false) {
$min: 768px;
$max: 1024px;
$pixel-ratio: 2;
@include mq(
$min-device-width: $min,
$max-device-width: $max,
$orientation: $orientation,
$-webkit-device-pixel-ratio: $pixel-ratio
) {
@content;
}
}
// orientation
// ----------------------------------------------------
@mixin landscape() {
@include mq($orientation: landscape) {
@content;
}
}
@mixin portrait() {
@include mq($orientation: portrait) {
@content;
}
}
@@ -0,0 +1,703 @@
@charset "UTF-8";
//-----------------------------------------------------
// mixin scss
// 包括常用的mixin, %, @function 及辅助的btn和背景图片icon
// mixin,通过@include调用,样式通过拷贝的方式使用,尤其适用于传递参数
// %,通过@extend调用,样式通过组合申明的方式使用,适用于不传参数的代码片段
// @function,返回一个值,用于调用
//-----------------------------------------------------
// mixin & %
// 既定义了mixin也定义了%,根据需求使用@include或@extend调用
//-----------------------------------------------------
// Center-align a block level element
@mixin center-block($extend: true) {
@if $extend {
@extend %center-block;
}
@else {
margin-left: auto;
margin-right: auto;
}
}
%center-block {
@include center-block(false);
}
// clearfix
@mixin clearfix($extend: true) {
@if $extend {
@extend %clearfix;
}
@else {
&::before,
&::after {
content: "";
display: table;
}
&::after {
clear: both;
}
}
}
%clearfix {
@include clearfix(false);
}
// Hide only visually, but have it available for screenreaders
// 只隐藏于视觉,屏幕浏览器可以阅读
@mixin hidden-clip($extend: true) {
@if $extend {
@extend %hidden-clip;
}
@else {
position: absolute;
clip: rect(1px, 1px, 1px, 1px);
}
}
%hidden-clip {
@include hidden-clip(false);
}
// ellipsis
@mixin ellipsis($extend: true) {
@if $extend {
@extend %ellipsis;
}
@else {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
%ellipsis {
@include ellipsis(false);
}
// ellipsis lines
// only old webkit flex box
@mixin ellipsis-lines($lines: 2) {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: $lines;
-webkit-box-orient: vertical;
}
// word-break
@mixin word-break($extend: true) {
@if $extend {
@extend %word-break;
}
@else {
white-space: normal;
word-wrap: break-word;
word-break: break-all;
}
}
%word-break {
@include word-break(false);
}
// disabled
// add !important
@mixin disabled($colorText: map-get($colorDisabled, text), $colorBg: map-get($colorDisabled, bg), $colorBorder: false) {
background-color: $colorBg !important;
color: $colorText !important;
cursor: default !important;
pointer-events: none !important;
@if $colorBorder {
border: 1px solid map-get($colorDisabled, border);
}
}
%disabled {
@include disabled;
}
// image replace text
@mixin ir($extend: true) {
@if $extend {
@extend %ir;
}
@else {
font: 0/0 a;
text-shadow: none;
border: 0 none;
color: transparent;
}
}
%ir {
@include ir(false);
}
// fixed top or bottom or bottom & top
@mixin fixed($pos: 0) {
position: fixed;
left: 0;
right: 0;
@if $pos == bottom {
bottom: 0;
} @else if $pos == all {
top: 0;
bottom: 0;
} @else {
top: $pos;
}
}
%fixed-top {
@include fixed;
}
%fixed-bottom {
@include fixed(bottom);
}
// justify
// 左右对齐
@mixin justify($extend: true) {
@if $extend {
@extend %justify;
}
@else {
display: flex;
justify-content: space-between;
}
}
%justify {
@include justify(false);
}
// retina border
// 0.5px实现 ios9
@mixin retina-one-px() {
@supports (border-width: 0.5px) {
@media only screen and (-webkit-min-device-pixel-ratio: 2), screen and (-webkit-min-device-pixel-ratio: 3) {
border-width: 0.5px;
}
}
}
// linear-gradient实现
// 安卓4.3- 不支持background-size的百分比
@mixin retina-one-px-bg($direction: top, $color: $colorBorder) {
background-repeat: no-repeat;
@if $direction == top {
background-image: linear-gradient(to bottom, $color 50%, transparent 50%);
background-size: 100% 1px;
}
@if $direction == bottom {
background-image: linear-gradient(to top, $color 50%, transparent 50%);
background-size: 100% 1px;
background-position: left bottom;
}
@if $direction == left {
background-image: linear-gradient(to right, $color 50%, transparent 50%);
background-size: 1px 100%;
}
@if $direction == right {
background-image: linear-gradient(to left, $color 50%, transparent 50%);
background-size: 1px 100%;
background-position: right top;
}
@if $direction == v { // 左右两个边框
background-image: linear-gradient(to right, $color 50%, transparent 50%),linear-gradient(to left, $color 50%, transparent 50%);
background-size: 1px 100%;
background-position: left top, right top;
}
@if $direction == h { // 上下两个边框
background-image: linear-gradient(to bottom, $color 50%, transparent 50%), linear-gradient(to top, $color 50%, transparent 50%);
background-size: 100% 1px;
background-position: left top, left bottom;
}
@if $direction == all { // 上下左右四个边框
background-image: linear-gradient(to bottom, $color 50%, transparent 50%), linear-gradient(to top, $color 50%, transparent 50%), linear-gradient(to right, $color 50%, transparent 50%),linear-gradient(to left, $color 50%, transparent 50%);
background-size: 100% 1px, 100% 1px, 1px 100%, 1px 100%;
background-position: left top, left bottom, left top, right top;
}
}
// border和transform实现
// 注意before和after的层级问题
@mixin retina-one-px-border($direction: top, $color: $colorBorder) {
position: absolute;
left: 0;
top: 0;
box-sizing: border-box;
@if $direction == top or $direction == bottom{
right: 0;
height: 0;
transform: scaleY(0.5);
border-top: 1px solid $color;
}
@if $direction == bottom {
top: auto;
bottom: 0;
}
@if $direction == right or $direction == left{
width: 0;
bottom: 0;
transform: scaleX(0.5);
border-left: 1px solid $color;
}
@if $direction == right {
left: auto;
right: 0;
}
@if $direction == all {
width: 200%;
height: 200%;
transform-origin: left top;
transform: scale(0.5);
border: 1px solid $color;
}
}
// border top & bottom
%border-tb {
position: relative;
&::before {
content: "";
@include retina-one-px-border(top);
z-index: 1;
}
&::after {
content: "";
@include retina-one-px-border(bottom);
}
}
// border all
%border-all {
position: relative;
&::before {
content: "";
@include retina-one-px-border(all);
z-index: -1;
}
}
// mixin
// 只定义了mixin,所以只能通过@include来调用
//-----------------------------------------------------
// table 等
// $child 参数请使用单引号,因为用于子元素选择器
@mixin equal-table($child: 'li') {
display: table;
table-layout: fixed;
width: 100%;
#{unquote($child)} {
display: table-cell;
}
}
// flex 等分
// $child 参数请使用单引号,因为用于子元素选择器
@mixin equal-flex($child: 'li') {
display: flex;
#{unquote($child)} {
flex: 1;
width: 1%;
}
}
// line equal gap
// $child 参数请使用单引号,因为用于子元素选择器
@mixin line-equal-gap($gap: 10px, $child: 'li', $lr: true) {
display: flex;
@if $lr {
padding-left: $gap;
padding-right: $gap;
}
#{unquote($child)} {
flex: 1;
width: 1%;
&:not(:first-of-type){
margin-left: $gap;
}
}
}
// line equal item
@mixin line-equal-item($lr: true) {
display: flex;
justify-content: space-between;
@if $lr {
&::before,
&::after {
content: "";
}
}
}
// flex center
@mixin center-flex($direction: both) {
display: flex;
@if $direction == both {
justify-content: center;
align-items: center;
}
@else if $direction == x {
justify-content: center;
}
@else if $direction == y {
align-items: center;
}
}
// translate center
@mixin center-translate($direction: both) {
position: absolute;
@if $direction == both {
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
@else if $direction == x {
left: 50%;
transform: translate3d(-50%, 0, 0);
}
@else if $direction == y {
top: 50%;
transform: translate3d(0, -50%, 0);
}
}
// object wrap
// $child 参数请使用单引号,因为用于子元素选择器
@mixin object-wrap($percent: 100%, $child: 'img') {
position: relative;
padding-top: $percent;
height: 0;
#{unquote($child)} {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
// triangle 三角箭头
// 可采用空元素或伪元素生成,具体定位这里不涉及
%triangle-basic {
content: "";
height: 0;
width: 0;
overflow: hidden;
}
@mixin triangle($direction: top, $borderWidth: 6px, $borderColor: $colorC) {
@extend %triangle-basic;
@if $direction == top {
border-bottom: $borderWidth solid $borderColor;
border-left: $borderWidth dashed transparent;
border-right: $borderWidth dashed transparent;
}
@else if $direction == right {
border-left: $borderWidth solid $borderColor;
border-top: $borderWidth dashed transparent;
border-bottom: $borderWidth dashed transparent;
}
@else if $direction == bottom {
border-top: $borderWidth solid $borderColor;
border-left: $borderWidth dashed transparent;
border-right: $borderWidth dashed transparent;
}
@else if $direction == left {
border-right: $borderWidth solid $borderColor;
border-top: $borderWidth dashed transparent;
border-bottom: $borderWidth dashed transparent;
}
}
// v arrow 方向箭头
@mixin v-arrow($direction: right, $borderWidth: 2px, $size: 10px) {
display: inline-block;
vertical-align: middle;
width: $size;
height: $size;
@if $direction == top {
border-top: $borderWidth solid currentColor;
border-right: $borderWidth solid currentColor;
transform: rotate(-45deg);
}
@else if $direction == right {
border-top: $borderWidth solid currentColor;
border-right: $borderWidth solid currentColor;
transform: rotate(45deg);
}
@else if $direction == bottom {
border-left: $borderWidth solid currentColor;
border-bottom: $borderWidth solid currentColor;
transform: rotate(-45deg);
}
@if $direction == left {
border-left: $borderWidth solid currentColor;
border-bottom: $borderWidth solid currentColor;
transform: rotate(45deg);
}
}
// selector
// 改变父元素状态,如:hover或.active
// 父元素不能有组合选择器,如.a, .b{}
// .parent{
// .child{
// @include parent-state(":hover"){
// color: #f00;
// }
// }
// }
// .parent:hover .child {
// color: #f00;
// }
@mixin parent-state($states...) {
$parent: nth(nth(&, 1), (length(nth(&, 1))-1));
@each $state in $states {
@at-root #{selector-replace(&, $parent, str-insert($state, $parent, 0))} {
@content;
}
}
}
// animation-fade
// @include animation-fade
// @include animation-fade($from: false, $to: .5);
// @include animation-fade($from: 1, $to: 0);
@mixin animation-fade($name: animationFade, $from: 0, $to: false){
@keyframes #{animationFade} {
@if $from {
from {
opacity: $from;
}
}
@if $to {
to {
opacity: $to;
}
}
}
}
// animation-translate
// @include animation-translate
// @include animation-translate($from: x -100%);
// @include animation-translate($from: xy -50% -50%, $to: y -100%);
// @include animation-translate($from: y 100px, $to: y 0px);
@mixin animation-translate($name: animationTranslate, $from: y -100%, $to: false) {
@keyframes #{$name} {
@if $from and length($from) > 1 {
from {
@if nth($from, 1) == x {
transform: translate(nth($from, 2), 0);
}
@if nth($from, 1) == y {
transform: translate(0, nth($from, 2));
}
@if nth($from, 1) == xy or nth($from, 1) == both {
transform: translate(nth($from, 2), nth($from, 3));
}
}
}
@if $to andd length($to) > 1 {
to {
@if nth($to, 1) == x {
transform: translate(nth($to, 2), 0);
}
@if nth($to, 1) == y {
transform: translate(0, nth($to, 2));
}
@if nth($to, 1) == xy or nth($to, 1) == both {
transform: translate(nth($to, 2), nth($to, 3));
}
}
}
}
}
// %
// 只定义了%,所以只能通过@extend来调用
//-----------------------------------------------------
// bar line
%bar-line {
line-height: $barHeight - 10px;
padding: 5px 10px;
position: relative;
display: block;
overflow: hidden;
@if $activeStateSwitch{
&:active,
&:hover {
background-color: darken($colorF, 3%);
}
}
&:not(:first-of-type)::before {
content: "";
@include retina-one-px-border;
}
}
// item arrow, 右侧箭头跳转指向
%item-v-right {
&::after {
content: "";
@include v-arrow;
color: $colorC;
position: absolute;
right: 15px;
top: 50%;
margin-top: -1px;
transform: rotate(45deg) translate(0, -50%);
box-sizing: border-box;
}
}
// 间隔列表
%gap-item{
position: relative;
background: #fff;
margin: 10px 0;
@if $activeStateSwitch{
&:active,
&:hover {
background-color: darken($colorF, 3%);
}
}
&::before{
content: "";
@include retina-one-px-border;
}
&::after{
content: "";
@include retina-one-px-border(bottom);
}
}
// 下面的几个%,由于版本或前缀,所以设计成%
//-----------------------------------------------------
// flex
%display-flex {
display: flex;
}
// all-transition
%transition-all {
transition: all 0.3s ease-in-out;
}
// translate3d
%translate3d {
transform: translate3d(0, 0, 0);
}
// btn
//----------------------------------------------------
// btn-basic
// 按钮基本样式,联合申明
%btn-basic {
display: inline-block;
vertical-align: middle;
cursor: pointer;
text-align: center;
border: 1px solid transparent;
box-sizing: border-box;
user-select: none;
padding: 0 1em;
white-space: nowrap;
}
// btn-size
// 按钮大小
@mixin btn-size($padding: 1em, $height: $barHeight, $radius: 3px) {
padding: 0 $padding;
line-height: $height - 2px; // 减掉2px的上下高度
@if $radius {
border-radius: $radius;
}
}
// btn-color
// 包括按钮背景色,文本色,是否有边框
@mixin btn-color($colorText: #333, $colorBg: #666, $colorBorder: false) {
color: nth($colorText, 1);
background-color: nth($colorBg, 1);
@if $colorBorder {
border-color: nth($colorBorder, 1);
}
&:hover,
&:active {
@if length($colorText) == 2 {
color: nth($colorText, 2);
}
@if length($colorBg) == 2 {
background-color: nth($colorBg, 2);
} @else {
@if lightness($colorBg) > 40% {
background-color: darken($colorBg, 5%);
}
@else {
background-color: lighten($colorBg, 5%);
}
}
@if $colorBorder and length($colorBorder) == 2 {
border-color: nth($colorBorder, 2); // $colorBorder: #dbdbdb #ccc => #ccc
}
}
}
//function
//-----------------------------------------------------
// 为颜色添加白色,以百分比形式
@function tint($color, $percent) {
@return mix(white, $color, $percent);
}
// 为颜色添加黑色,以百分比形式
@function shade($color, $percent) {
@return mix(black, $color, $percent);
}
%shadow {
box-shadow: 0px 0px 6px 0px rgba(0,0,0,.75);
}
%trans {
transition: all 0.2s ease-in;
-ms-transition: all 0.2s ease-in;
}
%trans8 {
transition: all 0.8s ease-in;
-ms-transition: all 0.8s ease-in;
}
%line-bg {
background: linear-gradient(200deg, #a0cfe4, #e8c37e);
}
%paper-bg {
background: url('./img/checkered-pattern.png') repeat #5d5d5d;
}
@@ -0,0 +1,418 @@
@charset "UTF-8";
//-----------------------------------------------------
// reset scss
// 包括normalize,清零重置
//-----------------------------------------------------
// normalize 4.0
// http://necolas.github.io/normalize.css/
//-----------------------------------------------------
// 1. Prevent mobile text size adjust after orientation change, without disabling user zoom.
// 2. Remove the gray background color from tap, default value is inherit
html {
-ms-text-size-adjust: 100%; // 1
-webkit-text-size-adjust: 100%; // 1
-webkit-tap-highlight-color: transparent; // 2
height: 100%;
}
// 1. Remove default margin
body {
margin: 0; // 1
font-size: $fontSize;
font-family: $fontFamily;
line-height: $fontLineHeight;
color: $colorText;
background-color: $colorBg;
min-height: 100%;
}
// HTML5 display definitions
//-----------------------------------------------------
// Correct `block` display not defined for any HTML5 element in IE 8/9.
// Correct `block` display not defined for `details` or `summary` in IE 10/11 and Firefox.
// Correct `block` display not defined for `main` in IE 11.
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
// 1. Correct `inline-block` display not defined in IE 9-.
audio,
canvas,
progress,
video {
display: inline-block; // 1
}
// Prevent modern browsers from displaying `audio` without controls.
// Remove excess height in iOS 5 devices.
audio:not([controls]) {
display: none;
height: 0;
}
// Add the correct vertical alignment in Chrome, Firefox, and Opera.
progress {
vertical-align: baseline;
}
// Address `[hidden]` styling not present in IE 8/9/10.
// Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
[hidden],
template {
display: none;
}
// Links
//-----------------------------------------------------
// 1. Remove the gray background color from active links in IE 10.
// 2. Improve readability when focused and also mouse hovered in all browsers.
a {
background: transparent; // 1
text-decoration: none;
color: nth($colorLink, 1);
&:active {
outline: 0; // 2
}
}
// Text-level semantics
//-----------------------------------------------------
// Address styling not present in IE 8/9/10/11, Safari, and Chrome.
abbr[title] {
border-bottom: 1px dotted;
}
// Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
b,
strong {
font-weight: bold;
}
// Address styling not present in Safari and Chrome.
dfn {
font-style: italic;
}
// Address styling not present in IE 8/9.
mark {
background: #ff0;
color: #000;
}
// Address inconsistent and variable font size in all browsers.
small {
font-size: 80%;
}
// Prevent `sub` and `sup` affecting `line-height` in all browsers.
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
// Embedded content
//-----------------------------------------------------
// 1. Remove border when inside `a` element in IE 8/9/10.
img {
border: 0; // 1
vertical-align: middle;
max-width: 100%;
}
// Correct overflow not hidden in IE 9/10/11.
svg:not(:root) {
overflow: hidden;
}
// Grouping content
//-----------------------------------------------------
// 1. Contain overflow in all browsers.
// 2. Improve readability of pre-formatted text in all browsers.
pre {
overflow: auto; // 1
white-space: pre; // 2
white-space: pre-wrap; // 2
word-wrap: break-word; // 2
}
// 1. Address odd `em`-unit font size rendering in all browsers.
code,
kbd,
pre,
samp {
font-family: monospace, monospace; // 1
font-size: 1em; // 2
}
// Forms
//-----------------------------------------------------
// Known limitation: by default, Chrome and Safari on OS X allow very limited
// styling of `select`, unless a `border` property is set.
// 1. Correct color not being inherited.
// Known issue: affects color of disabled elements.
// 2. Correct font properties not being inherited.
// 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
button,
input,
optgroup,
select,
textarea {
color: inherit; // 1
font: inherit; // 2
margin: 0; // 3
vertical-align: middle;
}
// Show the overflow in IE.
// 1. Show the overflow in Edge.
// 2. Show the overflow in Edge, Firefox, and IE.
button,
input, // 1
select { // 2
overflow: visible;
}
// Address inconsistent `text-transform` inheritance for `button` and `select`.
// All other form control elements do not inherit `text-transform` values.
// Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
// Correct `select` style inheritance in Firefox.
button,
select {
text-transform: none;
}
// 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
// and `video` controls.
// 2. Correct inability to style clickable `input` types in iOS.
// 3. Improve usability and consistency of cursor style between image-type
// `input` and others.
button,
html input[type="button"], // 1
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; // 2
cursor: pointer; // 3
}
// Re-set default cursor for disabled elements.
[disabled] {
cursor: default;
}
// Remove inner padding and border in Firefox 4+.
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
// 1. Address Firefox 4+ setting `line-height` on `input` using `!important` in
// the UA stylesheet.
input {
line-height: normal; // 1
}
// It's recommended that you don't attempt to style these elements.
// Firefox's implementation doesn't respect box-sizing, padding, or width.
// 1. Address box sizing set to `content-box` in IE 8/9/10.
// 2. Remove excess padding in IE 8/9/10.
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; // 1
padding: 0; // 2
}
// Fix the cursor style for Chrome's increment/decrement buttons. For certain
// `font-size` values of the `input`, it causes the cursor style of the
// decrement button to change from `default` to `text`.
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
// 1. Address `appearance` set to `searchfield` in Safari and Chrome.
// 2. Address `box-sizing` set to `border-box` in Safari and Chrome
// (include `-moz` to future-proof).
input[type="search"] {
-webkit-appearance: textfield; // 1
box-sizing: border-box;
}
// Remove inner padding and search cancel button in Safari and Chrome on OS X.
// Safari (but not Chrome) clips the cancel button when the search input has
// padding (and `textfield` appearance).
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
// Define consistent border, margin, and padding.
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
// 1. Correct `color` not being inherited in IE 8/9/10/11.
// 2. Remove padding so people aren't caught out if they zero out fieldsets.
legend {
border: 0; // 1
padding: 0; // 2
}
// 1. Remove default vertical scrollbar in IE 8/9/10/11.
textarea {
overflow: auto; // 1
resize: vertical;
vertical-align: top;
}
// Don't inherit the `font-weight` (applied by a rule above).
// NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
optgroup {
font-weight: bold;
}
// webkit focus outline
input,
select,
textarea,
button {
outline: 0;
}
// Android 下 input focus 消除高亮外框
textarea,
input {
-webkit-user-modify: read-write-plaintext-only;
}
// ie10 clear & password
input::-ms-clear,
input::-ms-reveal {
display: none;
}
// 表单placeholder样式
// 注意不可联合申明,否则无效
// Firefox 19+
input::-moz-placeholder,
textarea::-moz-placeholder {
color: $colorPlaceholder;
}
// Internet Explorer 10+
input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
color: $colorPlaceholder;
}
// Safari and Chrome
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
color: $colorPlaceholder;
}
// 如不支持placeholder添加class 或者 设置提示的placeholder
.placeholder{
color: $colorPlaceholder;
}
// Tables
//-----------------------------------------------------
// Remove most spacing between table cells.
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}
// 根据使用习惯,对normalize上进行补充
//-----------------------------------------------------
h1, h2, h3, h4, h5, h6, p, figure, form, blockquote {
margin: 0;
}
// ul ol dl
ul, ol, li, dl, dd {
margin: 0;
padding: 0;
}
ul, ol {
list-style: none outside none;
}
// hn
h1, h2, h3 {
line-height: 2;
font-weight: normal;
}
h1 {
font-size: 18px;
}
h2 {
font-size: 16px;
}
h3 {
font-size: 14px;
}
// icon
i {
font-style: normal;
}
// 所有元素为border-box
* {
box-sizing: border-box;
}
// 清除子元素浮动
.clearfix {
@extend %clearfix;
}
@@ -0,0 +1,83 @@
@charset "UTF-8";
//-----------------------------------------------------
// variables scss
//-----------------------------------------------------
// font相关
//-----------------------------------------------------
$fontSize: 14px !default;
$fontLineHeight: 1.5 !default;
$fontFamily: "Helvetica Neue", Helvetica, STHeiTi, Arial, sans-serif !default;
// ios华文黑体,Android 4.0之后,Android 4.0之前
$fontCn: STHeiTi, Roboto, "Droid Sans Fallback", Arial !default;
// ios4.0+,ios4.0-,Android 4.0+,Android 4.0-
$fontEn: "Helvetica Neue", Helvetica, Roboto, "Droid Sans", Arial !default;
// 背景色,文本色,边框色,链接色
//-----------------------------------------------------
$colorText: #333 !default;
$colorBg: #fff !default;
$colorBorder: #dbdbdb !default;
$colorLink: #08c !default;
$colorPlaceholder: #999 !default; // input placeholder color
$colorDisabled: (text: #999, bg: #e3e3e3, border: #dbdbdb) !default; // textColor bgColor borderColor
$colorOverlay: rgba(0,0,0,.7) !default; // 遮罩层颜色
// 基本颜色
// color function : http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html
// lighten($color, $amount)
// darken($color, $amount)
// opacity($color, $amount)
// mix($color1, $color2[, $amount])
//-----------------------------------------------------
$color3: #333;
$color6: #666;
$color9: #999;
$colorC: #ccc;
$colorF: #f5f5f5;
$blue: #007aff !default;
$orange: #ff9500 !default;
$red: #ff3b30 !default;
$green: #4cd964 !default;
$primary: #007aff !default;
// 元素上下间距
//-----------------------------------------------------
$gap: 20px !default;
// header,footer等的高度
//-----------------------------------------------------
$barHeight: 44px !default;
// radius
//-----------------------------------------------------
$radiusBase: 5px !default;
$radiusSmall: 3px !default;
// timing-function
//-----------------------------------------------------
$timingFunction: cubic-bezier(0.42, 0, 0.58, 1);
// active state switch
//-----------------------------------------------------
$activeStateSwitch: true !default;
// z-index
//-----------------------------------------------------
$zIndexHeader: 1000 !default;
$zIndexFooter: 2000 !default;
$zIndexPopup: 3000 !default;
$zIndexOverlay: 4000 !default; // 默认高于header和footer部分
$articlePadding: 7.6923%;