如何删除输入类型中的默认颜色?

时间:2023-03-16
本文介绍了如何删除输入类型中的默认颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我已经创建了输入类型并为该框创建了边框,但是当我单击该按钮时,它显示的是默认颜色,但我不应该显示默认颜色下面是显示的图像:

I had created the input type and created the border the border for that box,but when i had clicked in that button it is displaying the default color but i should not display the default color Below is the displayed image:

下面是我的html代码:

Below is my html code:

<ion-item  class="Credit">
<ion-input type="number"
            placeholder="Credit Card number"
            class="form-control"></ion-input>
</ion-item>

下面是我的css代码:

Below is my css code:

.Credit{  
        top: 20px;
         border-radius: 10px;
         width: 350px;
         display: block;
         margin-left: auto;
         margin-right: auto;
        background: url(../assets/images/credit_card.png);
        background-position:right;
        background-size: 45px;
        background-repeat:no-repeat;
        border:1px solid #DADADA;
        margin-bottom: 10px;


}

推荐答案

你可以尝试重写Ionic的样式规则,因为输入有效或无效时也会发生同样的情况:

You can try by overriding Ionic's style rules, because the same will also happen when the input is valid or invalid:

/* Workaround to hide android default validation colors */
ion-item.item-md.item-input.input-has-focus .item-inner,
ion-item.item-md.item-input.ng-valid.input-has-value:not(.input-has-focus) .item-inner,
ion-item.item-md.item-input.ng-invalid.ng-touched:not(.input-has-focus) .item-inner {
    border-bottom-color: #dadada;
    box-shadow: none;
}

/* Workaround to hide window phone default validation colors */
ion-item.item-wp.item-input.input-has-focus .text-input,
ion-item.item-wp.item-input.ng-valid.input-has-value:not(.input-has-focus) .text-input,
ion-item.item-wp.item-input.ng-invalid.ng-touched:not(.input-has-focus) .text-input {
    border: 2px solid #dadada;
}

更新

解决这个问题的更离子方式是在 variables.scss 文件中添加以下内容:

A more Ionic way to solve this, would be by adding the following in the variables.scss file:

// Ionic variables override
$text-input-ios-show-focus-highlight: false;
$text-input-md-show-focus-highlight: false;
$text-input-wp-show-focus-highlight: false;

这篇关于如何删除输入类型中的默认颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:如何将点击事件添加到打字稿中动态添加的html元素 下一篇:Ionic - Google 地方和自动填充位置

相关文章