How do you deal with div with mat-card-header-text in an material2 card?

后端 未结 10 1562
逝去的感伤
逝去的感伤 2021-02-18 20:04

I can\'t seem to wrap my head around having this container in an md card.

In my material cards, I have this:

&
10条回答
  •  感情败类
    2021-02-18 20:26

    If you want to support both a version with image in the header and without, this is one possible solution. The idea is to toggle a class which fixes the margin when there is no image available (set through the link input in the example). This way to card looks fine with and without an image.

    Html:

    
      
        {{content}}
        {{content}}
        
      
      
        {{content}}
      
      
        
      
    
    

    Css

    .fix-margin {
      margin: 0 -8px;
    }
    

    Ts

    export class component {
      @Input() content;
      @Input() link;    
    }
    

提交回复
热议问题