如何将边框半径添加到角垫表?

Sho*_*fol 3 angular-material angular mat-table

我正在尝试将mat-table边界设为圆形。但它不起作用。试过这个-

table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 1em;
}
Run Code Online (Sandbox Code Playgroud)

如何实现这一目标?

小智 13

对我来说最简单的解决方案是隐藏某些元素的溢出,当我们设置边框半径时,这些元素会给出未完成的外观。所以,我们只处理这个

.mat-table{    
    border-radius: 8px;
    overflow:hidden !important;
}
Run Code Online (Sandbox Code Playgroud)

请随意指出这可能导致其他问题的情况。


Eli*_*seo 7

问题是您需要覆盖 mat-table 的背景颜色:

.mat-table
{
  background-color:transparent!important;  
}
table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 5em;
}
table tr:last-child td /*To remove the last border*/
{
  border-bottom:0 solid
}
Run Code Online (Sandbox Code Playgroud)

闪电战