当设置背景颜色时,在Android版本4.0上的HTML选择框不显示下拉箭头 [英] HTML select box not showing drop-down arrow on android version 4.0 when set with background color
问题描述
我需要将选择框的背景颜色设置为黄色。
当我测试,它显示框与黄色的颜色和箭头在Android 2.3和android 3.0。
I need to set the background color for select box as yellow. When i tested,it does show box with yellow color and arrow on android 2.3 and android 3.0.
但是在Android 4.0上,它显示选择为完全黄色,没有下拉箭头。
But on android 4.0 it shows the select as complete yellow without the drop-down arrow.
如何解决这个问题?
我正在用phone-gap设计这个。
I am designing this with phone-gap.
<select style="background-color:#FFFF00;border:#FFFF00;height:25px;font-family:Arial, Helvetica, sans-serif; color:#000000; font-size:14px; font-weight:bold; text-align:center;">
<option></option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
推荐答案
Android浏览器的<
The Android Browser's rendering of <select>
s is buggy and will remove the normal styling if a background or border is applied.
由于
不幸的是,没有纯CSS选择/排除Android浏览器的方式,因此我建议您使用布局引擎(https://github.com/stowball/Layout-Engine ),它将添加一个 .browser-android $ c类$ c>到
< html>
标签。
Unfortunately, there's no pure CSS way of selecting/excluding the Android Browser, so I recommend you use Layout Engine (https://github.com/stowball/Layout-Engine), which will add a class of .browser-android
to the <html>
tag.
< select> 除了在Android浏览器上,例如:
You could then style all <select>
s except on Android Browser, like so:
html:not(.browser-android) select {
background: #0f0;
border: 1px solid #ff0;
}
这篇关于当设置背景颜色时,在Android版本4.0上的HTML选择框不显示下拉箭头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!