Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $YECBGYFECGEAFWHA as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2

Deprecated: imwpcache\f884414bce24ee67f\f73723ec7b1919fa5::__construct(): Implicitly marking parameter $BBWFDDBHHYHDXXAB as nullable is deprecated, the explicit nullable type must be used instead in /www/wwwroot/www.chuangxiangniao.com/wp-content/plugins/imwpcache-dist/build/f884414bce24ee67ff73723ec7b1919fa5.php on line 2
如何让Element UI栅格系统中同一行相邻单元格的高度自动适应内容?_创想鸟

如何让Element UI栅格系统中同一行相邻单元格的高度自动适应内容?

如何让element ui栅格系统中同一行相邻单元格的高度自动适应内容?

Element UI栅格系统:让同一行相邻单元格高度自适应内容

在使用Element UI栅格系统时,常常遇到同一行相邻单元格高度不一致的问题:内容较多的单元格撑高,而内容较少的单元格高度不变。本文将提供解决方案。

HTML结构

  上平行度  平行度OK/NG

CSS样式

.row {  border-bottom: solid .0625rem #9c9c9c;  display: flex;  /* align-items: center;  移除这行 */  justify-content: center;  .col {    /* height: 100%;  移除这行 */    display: flex;    flex-direction: column; /* 添加此行,使内容垂直排列 */    span:not(:last-child){      border-right: solid .0625rem #9c9c9c;    }    ::v-deep span {      flex: 1;      /* height: 100%;  移除这行 */      word-break: break-all;      word-wrap: break-word;      /* height: 23px;  移除这行 */      /* line-height: 23px;  移除这行 */      display: flex; /* 添加此行,使label内容垂直居中 */      align-items: center; /* 添加此行,使label内容垂直居中 */    }    .label{      background-color: #e0e0e0;      color: #000000;      font-weight: bold;      /* height:auto;  移除这行 */    }    .value{      /* height: auto;  移除这行 */    }  }}

问题与解决方案

问题在于el-col的高度限制了内部内容的高度。 通过设置align-items: stretch (或移除该属性,因为默认值就是stretch) 以及移除el-col和span的height属性,让单元格高度根据内容自动调整。 为了使内容垂直居中,我们添加了flex-direction: column和span元素的display: flex; align-items: center;。

通过以上修改,同一行相邻单元格的高度将根据其内容自动调整,并保持内容垂直居中。

以上就是如何让Element UI栅格系统中同一行相邻单元格的高度自动适应内容?的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1563867.html

赞 (0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
前端如何高效处理后台返回的重复数组数据并显示重复次数?
上一篇 2025年12月22日 08:41:53
如何用纯CSS实现等高子元素的横向排列?
下一篇 2025年12月22日 08:42:10

相关推荐

发表回复

登录后才能评论
关注微信