css - How to remove computed padding from ion-button when it is disabled
问题描述
Ionic Button, when disabled appears like it have two background colors in IOS. I am using ionic button with disabled property like this
<ion-button expand="full" type="submit" [disabled]="!loginForm.valid (click)="login()">Login</ion-button>
Here is how it looks when -
Form is Invalid
Form is valid
On inspecting i found, it’s the COMPUTED padding-inline-start: 16px; and padding-inline-end: 16px; that is causing this kind of background;
I am not using any extra css styling on the button. And this kind of background is visible only when you build the app for ios and run it into simulator or device.
So, How to remove that padding ?
解决方案
我建议将 ngClass 与 css 类结合使用:
[ngClass]="!loginForm.valid? 'no-start-end-padding'"
.
在 css 类中添加!important
以覆盖 16px 开始和结束填充值。
.no-start-end-padding {
padding-inline-start: 16px !important;
padding-inline-end: 16px !important;
}
推荐阅读
- php - 发送多封电子邮件时出错,应该只发送一封
- rest - 如果休息端点正在使用外部休息端点,Swagger/其他 API 文档/工具能否提供信息
- c# - HTTP 错误 403.14 - 禁止,本地主机:12401
- python - Python exec() 无法在函数中初始化类实例
- sql - sql server 数据透视表查询
- php - 如何在不修改它们的情况下获取所有 CRUD Mysql 查询的 ID?
- c++ - 递归回调:第一个回调禁用以下回调
- design-patterns - 什么设计模式最合适
- powershell - Powershell“系统找不到指定的路径”-最小示例
- java - GridBagLayout 没有按预期出现