css - 未能将边框半径样式应用于表格
问题描述
我正在尝试在我的角度应用程序中创建一个具有滚动条的表格。
在下面的代码中,我在 after 选择器的帮助下添加了一个 div,以在滚动条和表格容器之间添加一个空格。
因为当表格内容溢出时,表格父元素不采用'padding-right'样式。
但我的问题是:当我将边框半径样式应用于表格时,它不会应用它。谁能帮我解决这个问题?
.tableContainer {
padding: 20px;
background: #e7e7e7;
width: 1340px;
height: 200px;
overflow: scroll;
margin-left: 18px;
}
.tableContainer>table {
border-radius:20px;
position: relative;
width: 100%;
}
.tableContainer>table th {
padding: 10px;
color: #fff;
text-align: center;
}
.tableContainer>table td {
border: 3px solid #e1e1e1;
padding: 10px;
text-align: center;
}
.tableContainer table::after {
content: '';
position: absolute;
width: 20px;
height: 100%;
right: -20px;
top:0px;
}
<div class="tableContainer">
<table>
<!--<thead class="bg-dark">
<tr>
<th></th>
<th *ngFor="let thead of tableHeader">{{thead}}</th>
</tr>
</thead>-->
<tbody>
<tr class="bg-dark">
<th></th>
<th *ngFor="let thead of tableHeader">{{thead}}</th>
</tr>
<tr *ngFor="let key of tableColumnKeys;let i=index;" [class.firstRow]="i == 0">
<td>{{key}}</td>
<td *ngFor="let data of tableColumn[key]">
{{data}}
</td>
</tr>
</tbody>
</table>
</div>
解决方案
推荐阅读
- php - MySQL时间和PHP时间相差35秒
- vue.js - 试图理解在 vue 中对我的下拉菜单进行编码的更好方法
- python - 无法从地图上从不同的盒子状容器中刮取不同的所有者名称
- microsoft-graph-api - OneDrive 消费者上的应用程序权限的“租户没有 SPO 许可证”
- javascript - 未选中时复选框值显示为“on”
- http - 在运行 jsp 文件时获取 jasperException
- python - 运行fuzzywuzzy时如何摆脱属性错误?
- node.js - 如何在我的网站底部添加第 1、2、3、4 页下一步按钮
- javascript - Material-UI AppBar点击在反应中不起作用
- firecracker - Firecracker microVM:Firecracker microVM 启动时如何执行脚本文件?