[英]Angular/Material mat-form-field input - Floating label issues
[英]Hide Arrows From mat-form-field in Angular Material
我正在使用mat-form-field
输入电话号码。 这是我的基本代码。
<mat-form-field class="full-width">
<input matInput type="number" placeholder="Telefonnummer für Rückruf" value="" [(ngModel)]="this.inputValues.phone">
</mat-form-field>
顺便说一句,当我将 hover 放在它上面时,这个组件会显示箭头/旋转按钮。
请让我知道如何自定义此组件,使其不再显示箭头/旋转按钮。
亲切的问候,杰
只要输入类型为number
,就会出现箭头/微调器。 它可以使用 css/scss 删除。 此链接提供示例和更多信息。
试试这个 css/scss 代码:
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}
当您将以下 CSS 代码添加到style.css
时,它应该被隐藏。
/* Chrome, Safari, Edge, Opera */
input[matinput]::-webkit-outer-spin-button,
input[matinput]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[matinput][type=number] {
-moz-appearance: textfield;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.