Reduce the horizontal space between fields in flex layout using angular material.
Answers (1)
Add AnswerTo reduce the horizontal space between fields in a flex layout using Angular Material, you can adjust the spacing using the mat-form-field
class and the mat-grid-list
component.
Here are the steps you can follow:
Set the mat-grid-list
component to use a fixed number of columns, like this:
<mat-grid-list cols="2" rowHeight="2:1">
Use the mat-form-field
class to style your input fields, like this:
<mat-form-field class="example-form-field"> <input matInput placeholder="First Name"> </mat-form-field>
Define a custom style for the mat-form-field
class, like this:
.example-form-field { margin-right: 8px; }
This will set a margin of 8 pixels between each input field.