PhoneGap build webkit-appearance no drop down arrow for select tag

为君一笑 提交于 2019-11-27 07:27:23

问题


I'm using PhoneGap build and my select tags have no dropdown arrow on the phone. I tried applying -webkit-appearance: menulist; but this doesn't help, I tried other choices but still just shows the option with no drop down arrow.

It an issue with PhoneGap because the same code shows a dropdown arrow on the native browser on my Android phone.

Only once I use PhoneGap build does the arrow disappear. Any solutions?


回答1:


The Android Browser's rendering of <select>s is buggy and will remove the normal styling if a background or border is applied.

Since <select>s not looking like <select>s is a pretty big usability issue, your best bet is to not style them for this browser only.

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.

You could then style all <select>s except on Android Browser, like so:

html:not(.browser-android) select {
    background: #0f0;
    border: 1px solid #ff0;
}


来源:https://stackoverflow.com/questions/14738203/phonegap-build-webkit-appearance-no-drop-down-arrow-for-select-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!