Reputation:
I have this simple html:
<mat-card>
<mat-card-content>
<code>{{file}}</code>
</mat-card-content>
</mat-card>
for some reason when the mat-card element is rendered, it's not raised - I am looking to get something like this:
does anyone know if I might be missing some additional CSS? I don't get it.
Upvotes: 12
Views: 21070
Reputation: 2330
My issue was that I didnt have a theme imported in my styles.css:
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
Upvotes: 16
Reputation: 145880
If you have implemented a custom theme, make sure a parent of your mat-card
has this theme applied. This will typically be the app root.
My custom theme is rr-theme-light
- so I had to add this class to a parent of mat-card
in order to get the shadow to appear at all.
Upvotes: 0
Reputation: 3418
You probably just need a margin in your mat-card.
<mat-card style="margin:2em;">
...more code
</mat-card>
Here's a stackblitz demo
Upvotes: 16
Reputation:
I think you have to add a margin to the mat-card, so maybe
@Component({
styles: [`
mat-card { margin:2em; }
`]
})
Upvotes: 1