How to remove default color in input type?(如何删除输入类型中的默认颜色?)
问题描述
我已经创建了输入类型并为该框创建了边框,但是当我单击该按钮时,它显示的是默认颜色,但我不应该显示默认颜色下面是显示的图像:
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;
这篇关于如何删除输入类型中的默认颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何删除输入类型中的默认颜色?
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 400或500级别的HTTP响应 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01