Vue3框架中让table合计居中对齐

第一步:给它加一个类名 center-table 如下:

html 复制代码
 <el-table
      :data="datas.shows"
      max-height="600px"
      show-summary
      stripe
      border
      style="width: 100%"
      :header-cell-style="{ textAlign: 'center' }"
      :cell-style="{ textAlign: 'center' }"
      class="center-table"
    ></el-table>

第二步: 使用v-deep选择器

css 复制代码
:deep(.center-table td), 
:deep(.center-table th) {
  text-align: center !important;
}

效果

原创作者:吴小糖

创作时间:2023.11.24

相关推荐
烂蜻蜓2 分钟前
Flask入门教程(十):静态文件——CSS、JS与图片的正确管理方式
javascript·css·flask
名字还没想好☜9 分钟前
kubectl 排障实战:jsonpath 精准取值、custom-columns、events 排序与 top 速查
运维·前端·chrome·docker·kubernetes
李昊哲小课15 分钟前
Spring Boot 4 旅游主题实战教程 阶段二:Web 开发基础
前端·spring boot·旅游
Mr数据杨23 分钟前
【Codex】用学生支持周报模块跟踪个性化支持进展
android·java·javascript·django·codex·项目开发
独立开发之道1 小时前
【three.js教程】Three.js 材质详解:从“不反光“到“物理级真实“怎么选
开发语言·javascript·材质
ITmaster07311 小时前
从零到一!前端搭建本地轻量化 RAG 问答系统
前端
夏炳辉.1 小时前
Flex布局中 flex: 1 的完整解析与实战指南
前端·css·css3
CIO_Alliance2 小时前
AI提示系列(2)| Few-shot与ReAct有何不同? 大模型工具调用的底层逻辑详解
前端·人工智能·深度学习·神经网络·react.js·前端框架·ai+ipaas
waillyer2 小时前
企业知识库智能问答 Agent(React + Nest)
javascript·redis·agent
cindershade2 小时前
别只收三个数字:前端 RUM 如何建立可解释的体验数据链
前端