How to add space between header and body table in Angular Material 13?

Viewed 515
5 Answers

What you have seen here can work.

You must add modifiers in order to apply the style to material elements such as :host and ::ng-deep.

Then don't forget to play with the line-height attribute to modify the space between header and body.

This can be controversial because of supposed future deprecation and similarity with !important but it works well, and while you know what you do, it's not a bad thing to use them in my opinion.

I have forked your stackblitz project with the modifiers.

And here is a course for those modifiers, to understand how and when to use them.

You need to write your css in style.css

tbody:before {
  content: '\200C';
  display: block;
  line-height: 5rem;
  text-indent: -99999px;
}

example

Try adding this style:

th {
    padding-bottom: 50px !important;
}

Try to add an height to your thead like this in your css :

thead {
  height: 120px;
 }

table thead {
  border-bottom: 15px solid transparent;
}
Related