简体   繁体   English

选择选项中的Font Awesome Unicode在移动设备上中断

[英]Font Awesome Unicode in select option breaks on mobile

I have a select with currencies like this: 我可以选择以下货币:

<select class="new-challenge-bet-currency">
    <option value="usd">&#xf155;</option>
    <option value="eur">&#xf153;</option>
    <!-- keeps going with more currencies -->
</select>

Everything works fine on desktop browsers, and the mobile browser even displays the fa currency symbol on the selected item. 在台式机浏览器上一切正常,移动浏览器甚至在selected项目上显示fa货币符号。

Here is a screenshot of what happens on Chrome Android. 这是Chrome Android上发生的情况的屏幕截图。 As you can see, the selected currency ($) at the top display fine, but the white box that pops up when it's time to select a different option just displays broken X boxes. 如您所见,在顶部显示的所选货币($)很好,但是当需要选择其他选项时弹出的白框仅显示损坏的X框。

在此输入图像描述

Any idea how to get them to work? 知道如何让他们工作吗? Looking for a simple solution so I don't have to rework how currency selection is done all together. 寻找一个简单的解决方案,这样我就不必重新研究如何一起进行货币选择。

It's not just mobile, there has historically been difficulty in styling <option> as it has been rendered by native OS widgets instead of browser DOM. 它不仅是移动的,而且<option>样式历来也很困难,因为它是由本机OS小部件而不是浏览器DOM呈现的。 If you really must completely control the presentation of a <select> box you will need to replace it with scripted element. 如果确实必须完全控制<select>框的显示,则需要用脚本元素替换它。 (See select2 et al.) (请参阅select2等。)

However it is unclear to me why you are using Private Use Area characters with custom glyphs to render currency symbols for which there are perfectly good Unicode characters (U+0024 Dollar Sign, U+20AC Euro Sign) available. 但是,对我来说还不清楚,为什么要使用带有自定义字形的专用区域字符来呈现货币符号,而这些货币符号具有非常好的Unicode字符(U + 0024美元符号,U + 20AC欧元符号)。 If you can use real Unicode characters (still with custom font rendering if you prefer), then they should still be usable when displayed by non-browser widgets like this. 如果您可以使用真实的Unicode字符(如果愿意,还可以使用自定义字体渲染),那么当它们由非浏览器小部件显示时,它们仍然应该可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM