:::info 个人用的SASS初始化的一套样式 :::


    1. /*========================================
    2. *******初始化********
    3. *author:雷神(LEISHEN)
    4. *use:日常工作项目
    5. *支持的项目可以直接使用,不支持SASS可以转成CSS再使用
    6. ==========================================*/
    7. //定义变量
    8. $color:(white-df:#FFFFFF,black-df:#333333);//颜色
    9. $size:(xs:0.8,df:1,sm:1.4,lg:2,xl:2.8,xxl:3.2,sl:4,xsl:8);//尺寸倍数对应
    10. /* ==================
    11. 全局配置
    12. ==================== */
    13. html{
    14. font-size:10px;
    15. body{
    16. font-size:1.4rem;
    17. width: 100vw;
    18. min-height: 100vh;
    19. color: #333333;
    20. font-family: Helvetica Neue, Helvetica, sans-serif;
    21. }
    22. }
    23. body, div, dl, dt, dd, ul, ol, li,
    24. h1, h2, h3, h4, h5, h6, pre, code,
    25. form, fieldset, legend, input, button,
    26. textarea, p, blockquote, th, td {
    27. margin: 0;
    28. padding: 0;
    29. box-sizing: border-box;
    30. }
    31. a,a:visited{color: #333;text-decoration: none}
    32. /* ==================
    33. 公共Class
    34. ==================== */
    35. /* -- 块 -- */
    36. .block{display: block;}
    37. .hidden{display: none;}
    38. /* -- flex弹性布局 -- */
    39. .flex{display:flex}
    40. .flex-direction{flex-direction:column}//按列排列
    41. .flex-wrap{flex-wrap:wrap}//允许换行
    42. // 主轴对齐方式
    43. .justify-start{justify-content:flex-start}
    44. .justify-end{justify-content:flex-end}
    45. .justify-center{justify-content:center}
    46. .justify-between{justify-content:space-between}
    47. .justify-around{justify-content:space-around}
    48. // 副轴对齐方式
    49. .align-start{align-items:flex-start}
    50. .align-end{align-items:flex-end}
    51. .align-center{align-items:center}
    52. .align-stretch{align-items:stretch}
    53. // 单个项目对齐方式
    54. .self-start{align-self:flex-start}
    55. .self-center{align-self:flex-center}
    56. .self-end{align-self:flex-end}
    57. .self-stretch{align-self:stretch}
    58. .align-stretch{align-items:stretch}
    59. // 单个项目空间占比
    60. .basis-xs{flex-basis:20%}
    61. .basis-sm{flex-basis:40%}
    62. .basis-df{flex-basis:50%}
    63. .basis-lg{flex-basis:60%}
    64. .basis-xl{flex-basis:80%}
    65. // 单个项目显示比例
    66. .flex-sub{flex:1}
    67. .flex-twice{flex:2}
    68. .flex-treble{flex:3}
    69. /* -- 外边距 -- */
    70. .margin-no{margin:0;}
    71. .margin-auto{margin:auto;}
    72. @each $n,$v in $size {
    73. .margin-#{$n}{margin:1*$v+rem}
    74. .margin-top-#{$n}{margin-top:1*$v+rem}
    75. .margin-left-#{$n}{margin-left:1*$v+rem}
    76. .margin-right-#{$n}{margin-right:1*$v+rem}
    77. .margin-bottom-#{$n}{margin-bottom:1*$v+rem}
    78. .margin-lr-#{$n}{margin-left:1*$v+rem;margin-right:1*$v+rem;}
    79. .margin-tb-#{$n}{margin-top:1*$v+rem;margin-bottom:1*$v+rem;}
    80. }
    81. /* -- 内边距 -- */
    82. .padding-no{padding:0;}
    83. @each $n,$v in $size {
    84. .padding-#{$n}{padding:1*$v+rem}
    85. .padding-top-#{$n}{padding-top:1*$v+rem}
    86. .padding-left-#{$n}{padding-left:1*$v+rem}
    87. .padding-right-#{$n}{padding-right:1*$v+rem}
    88. .padding-bottom-#{$n}{padding-bottom:1*$v+rem}
    89. .padding-lr-#{$n}{padding-left:1*$v+rem;padding-right:1*$v+rem;}
    90. .padding-tb-#{$n}{padding-top:1*$v+rem;padding-bottom:1*$v+rem;}
    91. }
    92. /* -- 文字 -- */
    93. .text-Abc { text-transform: Capitalize;}//首字母大写
    94. .text-ABC {text-transform: Uppercase;}//全部大写
    95. .text-abc { text-transform: Lowercase;}//全部小写
    96. .text-price::before {content: "¥";margin-right: 0.8rem;}//人民币显示
    97. .text-bold{font-weight:700}//加粗
    98. .text-center{text-align:center}//居中
    99. .text-left{text-align:left}//居左
    100. .text-right{text-align:right}//居右
    101. .text-jusitify{text-align:justify;text-align-last: justify}//两侧对齐
    102. // 文字溢出显示省略号
    103. .text-cut1{overflow : hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1;-webkit-box-orient: vertical; }//单行
    104. .text-cut2{overflow : hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2;-webkit-box-orient: vertical; }//2行
    105. .text-cut3{overflow : hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3;-webkit-box-orient: vertical; }//三行
    106. // 文字大小
    107. @each $n,$v in $size {
    108. .text-#{$n}{font-size:1*$v+rem}
    109. }
    110. /* -- 颜色 -- */
    111. @each $cn,$cv in $color {
    112. .c-#{$cn}{color:$cv}
    113. .bg-#{$cn}{background-color:$cv}
    114. }
    115. /* -- 宽度 -- */
    116. @for $var from 1 to 10 {
    117. .width#{$var}{width:10%*$var} ;
    118. }
    119. /* -- 边框 -- */
    120. .border-no{border: none;}
    121. /* -- 圆角 -- */
    122. .round {border-radius: 100%; }//圆角
    123. .radius5{border-radius: 5px;}//小圆角
    124. .radius10{border-radius: 10px;}//小圆角
    125. .radius15{border-radius: 15px;}//小圆角
    126. .radius20{border-radius: 20px;}//小圆角
    127. .radius30{border-radius: 30px;}//小圆角