Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add border radius to angular mat table?

I am trying to make the mat-table border as round. But it is not working. Tried this-

table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 1em;
}

How to achieve this?

like image 263
Shofol Avatar asked Dec 18 '22 14:12

Shofol


2 Answers

The most simple solution that worked for me was to hide the overflow of certain elements that gave the unfinished look when we set the border-radius. So, we just handle that

.mat-table{    
    border-radius: 8px;
    overflow:hidden !important;
}

Feel free to point out cases where this might cause other issues.

like image 169
Ashish poojary Avatar answered Jan 04 '23 23:01

Ashish poojary


the problem is that you need over-ride the background-color of 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
}

stackblitz

like image 29
Eliseo Avatar answered Jan 05 '23 01:01

Eliseo