[英]Angular mat-form-field input & label
I use an angular material component to make a form, so I use mat-form-field.我使用有角度的材料组件来制作表格,所以我使用了 mat-form-field。
I would like to have the label on the left and a text input field on the right.我想要左边的标签和右边的文本输入字段。 How can I do this?
我怎样才能做到这一点? In the example on the official doc it is not possible to do this.
在官方文档的示例中,这是不可能的。
html html
<div class="container">
<mat-form-field appearance="legacy">
<mat-label>Nom</mat-label>
<input matInput formControl="nom">
</mat-form-field>
</div>
expected result: https://i.stack.imgur.com/5r63Z.jpg预期结果: https : //i.stack.imgur.com/5r63Z.jpg
You can use Flexbox CSS: https://css-tricks.com/snippets/css/a-guide-to-flexbox/您可以使用 Flexbox CSS: https ://css-tricks.com/snippets/css/a-guide-to-flexbox/
And you will have something like this:你会有这样的事情:
.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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.