flex布局样式 类名化scss(sass)

news2024/11/21 0:29:54

sass 和less 语法有差异需要转化一下


$directionList: row, row-reverse, column, column-reverse;
$justifyContentList: flex-start, flex-end, center, space-between, space-around, space-evenly;
$alignItemsList: flex-start, flex-end, center, baseline, stretch;

@mixin generateFlex($dr, $JC, $AI, $dir, $jc, $ai) {
  @if ($ai == center) {
    // flex-x-center
    .flex-#{$dr}-#{$JC} {
      display: flex;
      flex-direction: $dir;
      justify-content: $jc;
      align-items: center;
    }
  } @else {
    .flex-#{$dr}-#{$JC}-#{$AI} {
      display: flex;
      flex-direction: $dir;
      justify-content: $jc;
      align-items: $ai;
    }
  }
}
 
@each $dir in $directionList {
  $dr: if($dir == row, x, if($dir == column, y, $dir));
  
  @each $jc in $justifyContentList {
    $JC: if($jc == flex-start, start, if($jc == flex-end, end, if($jc == space-between, between, if($jc == space-evenly, evenly, if($jc == space-around, around, $jc)))));
    
    @each $ai in $alignItemsList {
      $AI: if($ai == flex-start, start, if($ai == flex-end, end, $ai));
      
      @include generateFlex($dr, $JC, $AI, $dir, $jc, $ai);
    }
  }
}

编译后

.flex-x-start-start {
	align-items: flex-start;
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
}
.flex-x-start-end {
	align-items: flex-end;
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
}
.flex-x-start {
	align-items: center;
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
}
.flex-x-start-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
}
.flex-x-start-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
}
.flex-x-end-start {
	align-items: flex-start;
	display: flex;
	flex-direction: row;
	justify-content: flex-end;
}
.flex-x-end-end {
	align-items: flex-end;
	display: flex;
	flex-direction: row;
	justify-content: flex-end;
}
.flex-x-end {
	align-items: center;
	display: flex;
	flex-direction: row;
	justify-content: flex-end;
}
.flex-x-end-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: row;
	justify-content: flex-end;
}
.flex-x-end-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: row;
	justify-content: flex-end;
}
.flex-x-center-start {
	align-items: flex-start;
	display: flex;
	flex-direction: row;
	justify-content: center;
}
.flex-x-center-end {
	align-items: flex-end;
	display: flex;
	flex-direction: row;
	justify-content: center;
}
.flex-x-center {
	align-items: center;
	display: flex;
	flex-direction: row;
	justify-content: center;
}
.flex-x-center-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: row;
	justify-content: center;
}
.flex-x-center-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: row;
	justify-content: center;
}
.flex-x-between-start {
	align-items: flex-start;
	display: flex;
	flex-direction: row;
	justify-content: space-between;
}
.flex-x-between-end {
	align-items: flex-end;
	display: flex;
	flex-direction: row;
	justify-content: space-between;
}
.flex-x-between {
	align-items: center;
	display: flex;
	flex-direction: row;
	justify-content: space-between;
}
.flex-x-between-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: row;
	justify-content: space-between;
}
.flex-x-between-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: row;
	justify-content: space-between;
}
.flex-x-around-start {
	align-items: flex-start;
	display: flex;
	flex-direction: row;
	justify-content: space-around;
}
.flex-x-around-end {
	align-items: flex-end;
	display: flex;
	flex-direction: row;
	justify-content: space-around;
}
.flex-x-around {
	align-items: center;
	display: flex;
	flex-direction: row;
	justify-content: space-around;
}
.flex-x-around-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: row;
	justify-content: space-around;
}
.flex-x-around-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: row;
	justify-content: space-around;
}
.flex-row-reverse-start-start {
	align-items: flex-start;
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-start;
}
.flex-row-reverse-start-end {
	align-items: flex-end;
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-start;
}
.flex-row-reverse-start {
	align-items: center;
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-start;
}
.flex-row-reverse-start-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-start;
}
.flex-row-reverse-start-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-start;
}
.flex-row-reverse-end-start {
	align-items: flex-start;
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
}
.flex-row-reverse-end-end {
	align-items: flex-end;
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
}
.flex-row-reverse-end {
	align-items: center;
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
}
.flex-row-reverse-end-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
}
.flex-row-reverse-end-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
}
.flex-row-reverse-center-start {
	align-items: flex-start;
	display: flex;
	flex-direction: row-reverse;
	justify-content: center;
}
.flex-row-reverse-center-end {
	align-items: flex-end;
	display: flex;
	flex-direction: row-reverse;
	justify-content: center;
}
.flex-row-reverse-center {
	align-items: center;
	display: flex;
	flex-direction: row-reverse;
	justify-content: center;
}
.flex-row-reverse-center-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: row-reverse;
	justify-content: center;
}
.flex-row-reverse-center-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: row-reverse;
	justify-content: center;
}
.flex-row-reverse-between-start {
	align-items: flex-start;
	display: flex;
	flex-direction: row-reverse;
	justify-content: space-between;
}
.flex-row-reverse-between-end {
	align-items: flex-end;
	display: flex;
	flex-direction: row-reverse;
	justify-content: space-between;
}
.flex-row-reverse-between {
	align-items: center;
	display: flex;
	flex-direction: row-reverse;
	justify-content: space-between;
}
.flex-row-reverse-between-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: row-reverse;
	justify-content: space-between;
}
.flex-row-reverse-between-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: row-reverse;
	justify-content: space-between;
}
.flex-row-reverse-around-start {
	align-items: flex-start;
	display: flex;
	flex-direction: row-reverse;
	justify-content: space-around;
}
.flex-row-reverse-around-end {
	align-items: flex-end;
	display: flex;
	flex-direction: row-reverse;
	justify-content: space-around;
}
.flex-row-reverse-around {
	align-items: center;
	display: flex;
	flex-direction: row-reverse;
	justify-content: space-around;
}
.flex-row-reverse-around-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: row-reverse;
	justify-content: space-around;
}
.flex-row-reverse-around-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: row-reverse;
	justify-content: space-around;
}
.flex-y-start-start {
	align-items: flex-start;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
}
.flex-y-start-end {
	align-items: flex-end;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
}
.flex-y-start {
	align-items: center;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
}
.flex-y-start-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
}
.flex-y-start-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
}
.flex-y-end-start {
	align-items: flex-start;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
}
.flex-y-end-end {
	align-items: flex-end;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
}
.flex-y-end {
	align-items: center;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
}
.flex-y-end-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
}
.flex-y-end-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
}
.flex-y-center-start {
	align-items: flex-start;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.flex-y-center-end {
	align-items: flex-end;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.flex-y-center {
	align-items: center;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.flex-y-center-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.flex-y-center-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.flex-y-between-start {
	align-items: flex-start;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}
.flex-y-between-end {
	align-items: flex-end;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}
.flex-y-between {
	align-items: center;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}
.flex-y-between-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}
.flex-y-between-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}
.flex-y-around-start {
	align-items: flex-start;
	display: flex;
	flex-direction: column;
	justify-content: space-around;
}
.flex-y-around-end {
	align-items: flex-end;
	display: flex;
	flex-direction: column;
	justify-content: space-around;
}
.flex-y-around {
	align-items: center;
	display: flex;
	flex-direction: column;
	justify-content: space-around;
}
.flex-y-around-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: column;
	justify-content: space-around;
}
.flex-y-around-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: column;
	justify-content: space-around;
}
.flex-column-reverse-start-start {
	align-items: flex-start;
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-start;
}
.flex-column-reverse-start-end {
	align-items: flex-end;
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-start;
}
.flex-column-reverse-start {
	align-items: center;
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-start;
}
.flex-column-reverse-start-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-start;
}
.flex-column-reverse-start-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-start;
}
.flex-column-reverse-end-start {
	align-items: flex-start;
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-end;
}
.flex-column-reverse-end-end {
	align-items: flex-end;
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-end;
}
.flex-column-reverse-end {
	align-items: center;
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-end;
}
.flex-column-reverse-end-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-end;
}
.flex-column-reverse-end-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-end;
}
.flex-column-reverse-center-start {
	align-items: flex-start;
	display: flex;
	flex-direction: column-reverse;
	justify-content: center;
}
.flex-column-reverse-center-end {
	align-items: flex-end;
	display: flex;
	flex-direction: column-reverse;
	justify-content: center;
}
.flex-column-reverse-center {
	align-items: center;
	display: flex;
	flex-direction: column-reverse;
	justify-content: center;
}
.flex-column-reverse-center-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: column-reverse;
	justify-content: center;
}
.flex-column-reverse-center-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: column-reverse;
	justify-content: center;
}
.flex-column-reverse-between-start {
	align-items: flex-start;
	display: flex;
	flex-direction: column-reverse;
	justify-content: space-between;
}
.flex-column-reverse-between-end {
	align-items: flex-end;
	display: flex;
	flex-direction: column-reverse;
	justify-content: space-between;
}
.flex-column-reverse-between {
	align-items: center;
	display: flex;
	flex-direction: column-reverse;
	justify-content: space-between;
}
.flex-column-reverse-between-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: column-reverse;
	justify-content: space-between;
}
.flex-column-reverse-between-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: column-reverse;
	justify-content: space-between;
}
.flex-column-reverse-around-start {
	align-items: flex-start;
	display: flex;
	flex-direction: column-reverse;
	justify-content: space-around;
}
.flex-column-reverse-around-end {
	align-items: flex-end;
	display: flex;
	flex-direction: column-reverse;
	justify-content: space-around;
}
.flex-column-reverse-around {
	align-items: center;
	display: flex;
	flex-direction: column-reverse;
	justify-content: space-around;
}
.flex-column-reverse-around-baseline {
	align-items: baseline;
	display: flex;
	flex-direction: column-reverse;
	justify-content: space-around;
}
.flex-column-reverse-around-stretch {
	align-items: stretch;
	display: flex;
	flex-direction: column-reverse;
	justify-content: space-around;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2244344.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

如何去掉el-input 中 type=“number“两侧的上下按键

<el-input v-model.trim"row.length" type"number" min"0" placeholder""></el-input> // 如何去掉el-input-number两侧的上下按键 ::v-deep input::-webkit-outer-spin-button, ::v-deep input::-webkit-inner-spin-butt…

前端注册代码

代码 <template><el-card class"register" style"max-width: 480px ; background-color: aliceblue;"><template #header><div class"card-header"><span>注册</span></div></template><el…

Node.js | Yarn下载安装与环境配置

一、安装Node.js Yarn 是 Node.js 下的包管理工具&#xff0c;因此想要使用 Yarn 就必须先下载 Node.js。 推荐参考&#xff1a;Node.js | npm下载安装及环境配置教程 二、Yarn安装 打开cmd&#xff0c;输入以下命令&#xff1a; npm install -g yarn检查是否安装成功&…

Golang | Leetcode Golang题解之第564题寻找最近的回文数

题目&#xff1a; 题解&#xff1a; func nearestPalindromic(n string) string {m : len(n)candidates : []int{int(math.Pow10(m-1)) - 1, int(math.Pow10(m)) 1}selfPrefix, _ : strconv.Atoi(n[:(m1)/2])for _, x : range []int{selfPrefix - 1, selfPrefix, selfPrefix …

创新租赁APP开发提升用户体验与业务效率

内容概要 在这个互联网飞速发展的时代&#xff0c;租赁APP的开发成为了提升市场竞争力的重要一环。用户对租赁服务的需求与日俱增&#xff0c;而传统的方式已显得不够高效。这时候&#xff0c;创新的租赁APP就像是一道光&#xff0c;照亮了用户体验和业务效率的双重需求。通过…

支持用户注册和登录、发布动态、点赞、评论、私信等功能的社交媒体平台创建!!!

需要整体源代码的可以在我的代码仓下载https://gitcode.com/speaking_me/social-media-platformTest.git 社交媒体平台 描述&#xff1a;社交媒体平台需要支持用户注册、发布动态、点赞、评论、私信等功能。 技术栈&#xff1a; 前端&#xff1a;React, Angular, Vue.js后端…

【MySQL实战45讲笔记】基础篇——redo log 和 binlog

系列文章 基础篇——MySQL 的基础架构 目录 系列文章1. 重要的日志模块&#xff1a;redo log 和 binlog1.1 redo log1.2 binlog1.3 执行器和 InnoDB 引擎内部如何执行更新语句 1. 重要的日志模块&#xff1a;redo log 和 binlog 前面系统的了解了一个查询语句的执行流程&…

【Redis】Redis实现的消息队列

一、用list实现【这是数据类型所以支持持久化】 消息基于redis存储不会因为受jvm内存上限的限制&#xff0c;支持消息的有序性&#xff0c;基于redis的持久化机制&#xff0c;只支持单一消费者订阅&#xff0c;无法避免消息丢失。 二、用PubSub【这不是数据类型&#xff0c;是…

(计算机毕设)基于SpringBoot+Vue的房屋租赁系统的设计与实现

博主可接毕设设计&#xff01;&#xff01;&#xff01; 各种毕业设计源码只要是你有的题目我这里都有源码 摘 要 社会的发展和科学技术的进步&#xff0c;互联网技术越来越受欢迎。网络计算机的生活方式逐渐受到广大人民群众的喜爱&#xff0c;也逐渐进入了每个用户的使用。互…

云原生之运维监控实践-使用Prometheus与Grafana实现对Nginx和Nacos服务的监测

背景 如果你要为应用程序构建规范或用户故事&#xff0c;那么务必先把应用程序每个组件的监控指标考虑进来&#xff0c;千万不要等到项目结束或部署之前再做这件事情。——《Prometheus监控实战》 去年写了一篇在Docker环境下部署若依微服务ruoyi-cloud项目的文章&#xff0c;当…

游戏引擎学习第19天

介绍 这段内容描述了开发者在进行游戏开发时&#xff0c;对于音频同步和平台层的理解和调整的过程。以下是更详细的复述&#xff1a; 开发者表达了他希望今天继续进行的工作内容。他提到&#xff0c;昨天他讲解了一些关于音频的内容&#xff0c;今天他想稍微深入讲解一下他正…

node版本升级,从卸载到使用nvm管理node版本并配置vue环境(学习趟雷版)

查找node版本和安装路径 查找当前node版本 node -v 查看弄得版本安装路径 where node 卸载node&#xff08;没安装过node的可以直接跳过&#xff09; 通过控制面板删除node&#xff0c;按下【winR】键&#xff0c;输入control 控制面板找到默认程序 找到node程序点击卸载 …

每天五分钟机器学习:支持向量机算法数学基础之核函数

本文重点 从现在开始,我们将开启支持向量机算法的学习,不过在学习支持向量机算法之前,我们先来学习一些支持向量机所依赖的数学知识,这会帮助我们更加深刻的理解支持向量机算法,本文我们先来学习核函数。 定义 核函数(Kernel Function)是一种在支持向量机(SVM)、高…

机器学习基础04

目录 1.朴素贝叶斯-分类 1.1贝叶斯分类理论 1.2条件概率 1.3全概率公式 1.4贝叶斯推断 1.5朴素贝叶斯推断 1.6拉普拉斯平滑系数 1.7API 2.决策树-分类 2.1决策树 2.2基于信息增益的决策树建立 2.2.1信息熵 2.2.2信息增益 2.2.3信息增益决策树建立步骤 2.3基于基…

STM32芯片EXIT外部中断的配置与原理以及模板代码(标准库)

配置EXIT外部中断其实就是把GPIO刀NVIC的各个外设配置好 第一步&#xff1a;配置RCC&#xff0c;把我们涉及到的外设的时钟都打开 &#xff08;此处EXTI是默认打开的&#xff0c;而NVIC是内核外设无需配置&#xff09; 第二步&#xff1a;配置GPIO,选择端口为输入模式 第三…

pytest结合allure做接口自动化

这是一个采用pytest框架&#xff0c;结合allure完成接口自动化测试的项目&#xff0c;最后采用allure生成直观美观的测试报告&#xff0c;由于添加了allure的特性&#xff0c;使得测试报告覆盖的内容更全面和阅读起来更方便。 1. 使用pytest构建测试框架&#xff0c;首先配置好…

生成自签名证书并配置 HTTPS 使用自签名证书

生成自签名证书 1. 运行 OpenSSL 命令生成证书和私钥 在终端中输入以下命令&#xff0c;生成自签名证书和私钥文件&#xff1a; sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout self_signed.key -out self_signed.pem-x509&#xff1a;生成自签名证书。…

Linux网络:守护进程

Linux网络&#xff1a;守护进程 会话进程组会话终端 守护进程setsiddaemon 在创建一个网络服务后&#xff0c;往往这个服务进程是一直运行的。但是对于大部分进程来说&#xff0c;如果退出终端&#xff0c;这个终端上创建的所有进程都会退出&#xff0c;这就导致进程的生命周期…

5.4.2-1 编写Java程序在HDFS上创建文件

本次实战涉及使用Java操作Hadoop HDFS&#xff0c;包括创建文件、判断文件存在性及异常处理。通过手动添加依赖、启动HDFS服务&#xff0c;成功在HDFS上创建和检查文件。进一步探索了文件操作的最佳实践&#xff0c;如检查文件存在性以避免重复创建&#xff0c;以及处理HDFS安全…

十六.SpringCloudAlibaba极简入门-整合Grpc代替OpenFeign

前言 他来了他来了&#xff0c;停了快2个月了终于又开始更新文章啦&#xff0c;这次带来的绝对是干货&#xff01;&#xff01;&#xff01;。由于公司项目进行重构的时候考虑到&#xff0c;OpenFeign做为服务通信组件在高并发情况下有一定的性能瓶颈&#xff0c;所以将其替换…