开发者

styling html text inputs for android. android overrides my design

开发者 https://www.devze.com 2023-04-11 18:04 出处:网络
My problem: I\'m designing a page with a darkish theme and I want my text inputs to follow the theme with dark background, light text. I simply set my text input like this:

My problem: I'm designing a page with a darkish theme and I want my text inputs to follow the theme with dark background, light text. I simply set my text input like this:

#name_of_my_text_input {
  background-color: black;
  color: white;
}

thi开发者_如何学编程s gets the desired result in desktop browsers and on iPhone but when I click the input on an Anddroid device (tried it on a HTC Sensation and some older Samsung) it defaults to white background with black text, looking totally horrible. Any way to stop Android from overriding my design or is this something I'll have to live with?

To specify: this is the relevant part of my layout. Just plain simple html:

<input id="name_of_my_text_input" type="text" name="n" />


Have you trieds using a reset.css? http://meyerweb.com/eric/tools/css/reset/

The goal of a reset stylesheet is to reduce browser inconsistencies in things like default line heights, margins and font sizes of headings, and so on.


Try to add -webkit-text-fill-color: #fff !important; to your css, that is:

#name_of_my_text_input {
  background-color: black;
  color: white;
  -webkit-text-fill-color: #fff !important;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号