htmlcssangularangular-materialangular-flex-layout

How to make make size of image responsive with flex layout Angular


I would like to make size of image responsive with respect to size of screen but it dies not work. I would like to show whole image in small screen but it is showing only half of the image. If someone know what is the issue then let me know. Thanks

<div class="flex-container" 
 fxLayout="row" 
 fxLayout.xs="column">
  <div class="flex-item" fxFlex=50>  
      <img alt="image" src="../assets/image.png"/>
  </div>
  <div class="flex-item" fxFlex=33>
     <img  alt="image" src="../assets/image.png"/>
  </div>  
</div>

Solution

  • It can be done as follow:

     <div fxFlexFill class="example-container">
        <div fxLayout="column" fxLayoutGap="32px" [style.height]="'100%'">
          <mat-card class="card-margins">
            <mat-card-title></mat-card-title>
              <div
                fxLayout="row"
                fxLayoutGap="32px"
                fxLayout.lt-sm="column"      
                fxLayoutGap.lt-sm="10px">
                <div fxFlex="0 100 100%">
                    <img mat-card-image src="../assets/image.png" alt="Free image">
                </div>
              </div>
              <div fxFlex="0 0 calc(50%-36px)">
                <mat-card-content>
                  <p>Hi, how are you?</p>
                </mat-card-content>
                </div>
            </mat-card>
          </div>
        </div>