【发布时间】:2018-06-30 18:53:53
【问题描述】:
我已经使用材质表单在对话框中创建了一个表单,但我似乎无法让输入宽于 180 像素,尽管遵循了包括 https://material.angular.io/components/input/example 在内的众多示例。
我确信这是一个非常标准的 CSS 东西,但我没有那种头脑,所以我无法弄清楚问题所在。
有没有人有一个有效的严肃/不平凡的例子??
这是我的:
<h1 mat-dialog-title>{{title}}</h1>
<mat-dialog-content>
<form novalidate #f="ngForm" class="form-full-width">
<mat-form-field class="input-full-width">
<input type="text" [(ngModel)]="data.name" name="name" matInput placeholder="Name">
<mat-hint>Enter a unique name.</mat-hint>
</mat-form-field>
<mat-form-field class="input-full-width">
<textarea [(ngModel)]="data.description" name="description" matInput placeholder="Description"></textarea>
<mat-hint>You should describe the purpose/use of this thing.</mat-hint>
</mat-form-field>
</form>
</mat-dialog-content>
CSS:
.form-full-width {
min-width: 150px;
max-width: 500px;
width:100%;
}
.input-full-width {
width:800px;
}
.mat-form-field.mat-form-field {
width: auto;
}
谢谢。
【问题讨论】:
标签: css angular angular-material2