简体   繁体   English

造型角材料输入

[英]Styling angular material input

I created an outline textbox:我创建了一个大纲文本框:

<mat-form-field appearance="outline">
    <input matInput placeholder="Username">
  </mat-form-field>

I am trying to control the height, the border color using:我正在尝试使用以下方法控制高度和边框颜色:

.mat-form-field {
  height:20px;
  border:1px solid #f0f;
}

But the result is far from the desired.但结果远非理想。 Is there a way it can be done?有没有办法做到? Sample code I created on stackblitzhttps://stackblitz.com/edit/angular-material-custom-input-j3k2h我在 stackblitzhttps://stackblitz.com/edit/angular-material-custom-input-j3k2h上创建的示例代码

You can add this style to edit height:您可以添加此样式来编辑高度:

.mat-form-field-infix {padding:0 !important; border:0 !important;}
.mat-form-field-flex{ margin:0 !important; padding:5px !important; padding-bottom: 17px !important; height: 20px !important;}
.mat-form-field-wrapper { padding: 0 !important; }

And this one to edit the border-color:而这个编辑边框颜色:

.mat-form-field-appearance-outline .mat-form-field-outline {
  color: #f0f;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM