angular - 删除 Angular Material 文本框边框,不影响其他组件

标签 angular typescript angular-material material-design angular7

有没有什么办法可以去除Material Textbox的轮廓边框而不需要Ng深,影响其他组件?

需要删除下面的边框,此代码会影响页面内的其他组件

How to remove the outline mat-form-filed border corner radius

enter image description here

::ng-deep div.mat-form-field-outline-start{
    border-color: 0 !important;
    border-width: 0px !important;
}

::ng-deep .mat-form-field-outline-gap{
    border-color: 0 !important;
    border-width: 0px !important;
}

::ng-deep .mat-form-field-outline-end{
    border-color: 0 !important;
    border-width: 0px !important;
}

当前使用轮廓 Material 文本框,

<div class="input-wrap">
    <mat-form-field appearance = "outline">
        <input matInput test >
    </mat-form-field>
</div>

最佳答案

如果您将外观属性从轮廓更改为标准,则应该删除边框

<div class="input-wrap">
    <mat-form-field appearance = "standard">
        <input matInput test >
    </mat-form-field>
</div>

这里提供了与您可以插入表单字段的不同外观相关的更多信息:

https://material.angular.io/components/form-field/overview#form-field-appearance-variants

关于angular - 删除 Angular Material 文本框边框,不影响其他组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59255266/

相关文章:

javascript - 需要在选中复选框后立即取消选中该复选框。 Angular 4

typescript - 将 FormGroup 映射到界面对象

javascript - 从 Cloud Firestore 在 MatDatepicker 中加载时间戳 |火力地堡

typescript - 为什么 T[string] 不是 TypeScript 中的有效对象查找类型?

Angular Material 在某些组件中不起作用

angular - 测试 Angular Material 表正在呈现正确的数据

angular - 如何获得 Angular 版本?

html - 在弹出窗口上设置时间延迟(Angular 4+)?

Angular 2如何设置嵌入元素的样式?

reactjs - 修复使用 TypeScript 时由 Document<any> 和 ctx.renderPage = () 引发的 next.js _document.tsx 中的 ESLint 警告