/* ==================
flex弹性布局
==================== */
.flex {
display: flex;
&-direction {
flex-direction: column;
}
&-wrap {
flex-wrap: wrap;
}
&-basis-xs {
flex-basis: 20%;
}
&-basis-sm {
flex-basis: 40%;
}
&-basis-df {
flex-basis: 50%;
}
&-basis-lg {
flex-basis: 60%;
}
&-basis-xl {
flex-basis: 80%;
}
}
.align {
&-start {
align-items: flex-start;
}
&-end {
align-items: flex-end;
}
&-center {
align-items: center;
}
&-stretch {
align-items: stretch;
}
}
.self{
&-start {
align-self: flex-start;
}
&-center {
align-self: center;
}
&-end {
align-self: flex-end;
}
&-stretch {
align-self: stretch;
}
}
.justify{
&-start {
justify-content: flex-start;
}
&-end {
justify-content: flex-end;
}
&-center {
justify-content: center;
}
&-between {
justify-content: space-between;
}
&-around {
justify-content: space-around;
}
}
/* ==================
flex布局占比 1-10
==================== */
@for $i from 1 to 10 {
.flex-#{$i} {
flex: $i !important;
}
}
/* ==================
强制不换行
==================== */
.nowrap {
white-space: nowrap;
}
/* ==================
文本内容对齐方式
==================== */
@each $i in left, right, center {
.text-#{$i} {
text-align: $i;
}
}
/* ==================
定义代码显示的行数,超出使用...代替
==================== */
@for $i from 1 through 10 {
.text-cut-#{$i} {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: $i;
-webkit-box-orient: vertical;
}
}
/* ==================
字体大小Size
==================== */
// 定义字体(px)单位,大于或等于20的都为px单位字体
@for $i from 10 through 200 {
.font-#{$i} {
font-size: $i + px !important;
}
}
/* ==================
字体粗细程度
==================== */
@each $i in 100, 200, 300, 400, 500, 600, 700, 800, 900 {
.text-#{$i} {
font-weight: $i;
}
}
/* ==================
边框设置
==================== */
@for $i from 0 through 100 {
// 只要双数和能被5除尽的数
@if $i % 2 == 0 {
// 得出:br-30
.br-#{$i} {
border-radius: $i + px !important;
}
.br-tl-#{$i} {
border-top-left-radius: $i + px !important;
}
.br-tr-#{$i} {
border-top-right-radius: $i + px !important;
}
.br-bl-#{$i} {
border-bottom-left-radius: $i + px !important;
}
.br-br-#{$i} {
border-bottom-right-radius: $i + px !important;
}
// 高度占比
.h-#{$i}vh {
height: $i + vh !important;
}
// 宽度占比
.w-#{i}vw {
width: $i + vw !important;
}
}
}
/* ==================
宽度、高度
==================== */
@for $i from 0 through 300 {
// 只要双数和能被5除尽的数
@if $i % 2 == 0 or $i % 5 == 0 {
.h-#{$i} {
height: $i + px !important;
}
.w-#{i} {
width: $i + px !important;
}
}
}
/* ==================
内外边距
==================== */
// 定义内外边距,历遍1-80
@for $i from 0 through 80 {
// 只要双数和能被5除尽的数
@if $i % 2 == 0 or $i % 5 == 0 {
// 得出:m-30
.m-#{$i} {
margin: $i + px !important;
}
.m-tb-#{$i} {
margin: $i + px 0 !important;
}
.m-lr-#{$i} {
margin: 0 $i + px !important;
}
// 得出:p-30
.p-#{$i}{
padding: $i + px !important;
}
.p-tb-#{$i} {
padding: $i + px 0 !important;
}
.p-lr-#{$i} {
padding: 0 $i + px !important;
}
@each $short, $long in l left, t top, r right, b bottom {
// 缩写版,结果如: m-l-30
// 定义外边距
.m-#{$short}-#{$i} {
margin-#{$long}: $i + px !important;
}
// 定义内边距
.p-#{$short}-#{$i} {
padding-#{$long}: $i + px !important;
}
}
}
}
04-22
03-09
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交