1

我使用有角度的材质组件来制作表格,所以我使用mat-form-field.

我想在左边有标签,在右边有一个文本输入字段。我怎样才能做到这一点?在官方文档的示例中,这是不可能的。

html

<div class="container">
  <mat-form-field appearance="legacy">
    <mat-label>Nom</mat-label>
    <input matInput formControl="nom">
  </mat-form-field>
</div>

预期结果:

在此处输入图像描述

4

1 回答 1

0

您可以使用 Flexbox CSS:https ://css-tricks.com/snippets/css/a-guide-to-flexbox/

你会有这样的东西:

.row {
  display: flex;
  flex-direction: row;
}
<div class="container">
  <mat-form-field class="row" appearance="legacy">
    <mat-label>Nom:</mat-label>
    <input matInput formControl="nom">
  </mat-form-field>
</div>

于 2021-10-19T09:32:38.420 回答