el-table去掉滚动条与右侧间隙

本文介绍了如何在使用 Element UI 的 el-table 组件时,通过 CSS(SCSS)样式来去除滚动条并消除右侧间隙,实现理想的显示效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

el-table去掉滚动条与右侧间隙

效果图

生成的效果图,目前我看到的都是OK的,有问题希望反馈一下
效果图

css样式

我用的scss写法

.teml_box{
	::v-deep .el-table{
		border-color: #CCD3DC;
		border-top: 0;
		border-left: 0;
		border-radius: 4px;
		tr {
			th {
				border-top: 1px solid #CCD3DC;
				background-color: #EFF1F5;

				.cell {
					padding: 0 5px;
					color: #525E71;
				}
			}

			th.gutter {
				display: none;
			}

			th,td {
				border-color: #CCD3DC;
				font-weight: 400;
				padding: 6px 0;
			}

			td {
				.el-input__inner {
					color: #222426;
					border-color: #dddfe6;
					height: 30px;
				}

				.el-input__icon {
					line-height: 30px;
				}

				.cell {
					padding: 0 5px;
					color: #171A20;
					.active_btn {
						color: #207CFC;
					}
				}
			}

			td:nth-of-type(1),th:nth-of-type(1) {
				border-left: 1px solid #CCD3DC;

				.cell {
					color: #525E71;
				}
			}

			th:nth-of-type(1) {
				border-radius: 4px 0 0 0;
			}

			th:nth-last-of-type(2) {
				border-radius: 0 4px 0 0;
			}
		}

		tr:last-of-type {
			td:nth-of-type(1) {
				border-radius: 0 0 0 4px;
			}

			td:last-of-type {
				border-radius: 0 0 4px 0;
			}
		}
		.el-table__empty-block {
			border-right: 1px solid #CCD3DC;
			border-left: 1px solid #CCD3DC;
			border-bottom: 1px solid #CCD3DC;
			border-radius: 0 0 4px 4px;
			height: 99% !important;
		}

		.el-table__body {
			padding-bottom: 1px;
		}
	}
	::v-deep .el-table::before {
      	width: 0;
    }

    ::v-deep .el-table::after {
      	height: 0;
    }
	::v-deep .el-table__body-wrapper::-webkit-scrollbar {
		width: 0;
	}
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值