Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding ripple to mat-card without the card expanding on click/touch

Im trying to add a ripple effect to a card using angular material. The ripple effect works the way it supposed except that it expands the hight of the card when the effect is active. How can I stop the card from expanding?

<mat-card mat-ripple>
  <mat-card-content>This is content</mat-card-content>
</mat-card>

Stackblitz that demonstrates the behaviour

like image 451
Jonas Andreasson Avatar asked Feb 04 '18 15:02

Jonas Andreasson


2 Answers

If you add the footer element (with or without content) you won't need additional CSS and this will lock the height when activating the ripple effect.

<mat-card mat-ripple>
  <mat-card-content>This is content</mat-card-content>
  <mat-card-footer></mat-card-footer>
</mat-card>
like image 67
stupidFace Avatar answered Oct 16 '22 16:10

stupidFace


Use a div -Tag inside of mat-card -Tag. This Fix my issue.

like image 29
Muhammad Bilal Avatar answered Oct 16 '22 18:10

Muhammad Bilal