如何更改下拉列表项的字体系列? [英] How to change font-family of drop down's list item?

查看:34
本文介绍了如何更改下拉列表项的字体系列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列出字体系列的下拉菜单.像 Tahoma、Arial、Verdana 等.我想根据它代表的值更改每个下拉项的字体系列.就像 Photoshop 一样.

I have a drop-down that lists font families. Like Tahoma, Arial, Verdana, etc. I want to change the font-family of each drop-down item according to the value it represents. Just like Photoshop does it.

我更改了每个下拉项的 CSS,但它仅适用于 FireFox.它不适用于任何其他浏览器.

I changed the CSS for each drop-down item but it only works on FireFox. It doesn't work on any other browser.

我不想使用任何 jQuery 插件.

I don't want to use any jQuery plugin.

推荐答案

那是因为 select 元素子元素 (options) 不是真正的样式,而 firefox 似乎成为唯一忽略规范那部分内容的浏览器.

That's because the select elements children (options) aren't really stylable and firefox seems to be the only browser to ignore that part of the spec.

解决方法是将您的 select 元素替换为自定义小部件,该小部件仅使用可样式化的元素和一些用于交互的 javascript.就像这里所做的一样:http://jsfiddle.net/sidonaldson/jL7uU/http://jsfiddle.net/theredhead/4PQzp/

The workaround is to replace your select element with a custom widget that uses only stylable elements and perhaps a little javascript for the interactivity. like what's done here: http://jsfiddle.net/sidonaldson/jL7uU/ or http://jsfiddle.net/theredhead/4PQzp/

这篇关于如何更改下拉列表项的字体系列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆