我正在使用 Ionic 2 rc0 开发一个应用程序,并且在整个应用程序中有几个仍然需要样式的输入字段.
I am working on an application using Ionic 2 rc0 and have several input fields throughout the application that still need styling.
<ion-item class="su-p3-item">
<ion-label floating class="su-input">Your name</ion-label>
<ion-input type="text" class="su-input"></ion-input>
</ion-item>
ionic 2 输入接口 http://ionicframework.com/docs/v2/api/components/input/Input/
ionic 2 input api http://ionicframework.com/docs/v2/api/components/input/Input/
具体来说,我需要更改占位符文本的样式,以及活动时的底部边框.通过 API,并提供 SASS 变量覆盖,我无法弄清楚如何覆盖继承的边框样式和输入字段的占位符文本.
Specifically, I need to change the styling of the placeholder text, and bottom-border when active. Through the API, and provided SASS variable overrides, i could not figure out how to override the inherited styles for borders and placeholder text for input fields.
除了影响每个输入所在的特定页面的这些更改之外,我想避免使用!important"(我不希望更改为全局").
I would like to avoid using '!important' in addition to these changes on affecting the specific page each input is on (I dont want the changes to be 'global').
使用 Ionic2 RC4,您必须在 app.scss 文件中添加以下行:
With Ionic2 RC4, you have to add the following line in your app.scss file:
.text-input::-moz-placeholder {
color: white;
}
.text-input:-ms-input-placeholder {
color: white;
}
.text-input::-webkit-input-placeholder {
text-indent: 0;
color: white;
}
这篇关于Ionic 2 占位符文本样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在 Angular 2/Typescript 中使用 IScrollUse IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
Anime.js 在 Ionic 3 项目中不起作用anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 项目中不起作用)
Angular 2:在本地 .json 文件中找不到文件Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
将 ViewChild 用于动态元素 - Angular 2 &离子2Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(将 ViewChild 用于动态元素 - Angular 2 amp;离子2)
如何在 ionic2 中的 pop() 之后重新加载离子页面How to reload the ion-page after pop() in ionic2(如何在 ionic2 中的 pop() 之后重新加载离子页面)
当 Ionic 2 中的值发生变化时检索本地存储值Retrieve localstorage value when value is change in Ionic 2(当 Ionic 2 中的值发生变化时检索本地存储值)