I can't seem to wrap my head around having this container in an md card.
In my material cards, I have this:
<div class="mat-card-header-text"> </div>
I've seen other people notice it. It causes a 40px space on the left of my title. No CSS seems to affect it either.
I am using Angular 4.x and Material2.
Seems you are looking for the CSS style justify-content: center . This will center your content in the Mat-Card-Content.
The default behavior of flex-layout is to stretch components across the cross axis. In your case this is the height of the cards. This is controlled by the fxLayoutAlign property which defaults to "start stretch" . To change this, add fxLayoutAlign="start start" to your outer <div fxLayout="row"> .
The <mat-card> is a container for the content that can be used to insert the media, text & action in context to the single subject. The basic requirement for design the card is only an <mat-card> element that has some content in it, that will be used to build simple cards.
This extra div is actually quite annoying. As it turns out though, you can use shadow-piercing to apply a style to it without changing the CSS emulation mode. You can do this using the ::ng-deep combinator as such:
::ng-deep .mat-card-header-text { /* CSS styles go here */ margin: 0px; // for example to remove the margin }
You can also just replace the whole header with your own CSS classes instead:
<mat-card> <div class="your-header"> <div class="your-title"> Your title here </div> </div> <mat-card-content> Stuff goes here </mat-card-content> </mat-card>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With