为什么我不能在IE8中更改选择样式?

时间:2022-04-16 22:50:52

I wanna change font style in select-option box.

我想在select-option框中更改字体样式。

I have tested in IE6, chrome, Sapari.....it is working!

我已经在IE6,Chrome,Sapari中进行了测试.....它正在运行!

but it wasn't working in IE8

但它不适用于IE8

It did not working :

它没有工作:

<select name="myselect">
  <option val="1" style="font-family: Nanum Gothic, sans-serif;">All</option>
  <option val="2" style="font-family: Nanum Gothic, sans-serif;">Name</option>
  <option val="3" style="font-family: Nanum Gothic, sans-serif;">Phone</option>
</select>

And It did not working :

它没有工作:

<select name="myselect" style="font-family: Nanum Gothic, sans-serif;">
  <option val="1">All</option>
  <option val="2">Name</option>
  <option val="3">Phone</option>
</select>

IE8 have any bug about select-option tag?

IE8有关于select-option标签的任何错误吗?

Or It is normal?

还是很正常的?

Thanks.

1 个解决方案

#1


1  

I'm seeing a different cross-browser behavior. The option-styling method is not supported by IE8/9, Chrome18 (embedded in my editor) and FF30.

我看到了不同的跨浏览器行为。 IE8 / 9,Chrome18(嵌入在我的编辑器中)和FF30不支持选项样式方法。

The select-styling method is supported by IE8/9 and Chrome18, but not by FF30. Test it for yourself with this demo. Its code:

IE8 / 9和Chrome18支持选择样式方法,但FF30不支持。使用此演示自行测试。它的代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Demo</title>
</head>
<body>
    <select name="myselect1">
      <option val="1" style="font-family: sans-serif;">All</option>
      <option val="2" style="font-family: serif;">Name</option>
      <option val="3" style="font-family: sans-serif;">Phone</option>
    </select>

    <select name="myselect2" style="font-family: sans-serif;">
      <option val="1">All</option>
      <option val="2">Name</option>
      <option val="3">Phone</option>
    </select>

    <select name="myselect3" style="font-family: serif;">
      <option val="1">All</option>
      <option val="2">Name</option>
      <option val="3">Phone</option>
    </select>
</body>
</html>

Also, be aware that, like Niet The Dark Absol already implied in his comment, all styling is ignored by touchscreens. No matter which browser is used.

此外,请注意,就像Niet The Dark Absol已经在他的评论中暗示的那样,触摸屏会忽略所有样式。无论使用哪种浏览器。

#1


1  

I'm seeing a different cross-browser behavior. The option-styling method is not supported by IE8/9, Chrome18 (embedded in my editor) and FF30.

我看到了不同的跨浏览器行为。 IE8 / 9,Chrome18(嵌入在我的编辑器中)和FF30不支持选项样式方法。

The select-styling method is supported by IE8/9 and Chrome18, but not by FF30. Test it for yourself with this demo. Its code:

IE8 / 9和Chrome18支持选择样式方法,但FF30不支持。使用此演示自行测试。它的代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Demo</title>
</head>
<body>
    <select name="myselect1">
      <option val="1" style="font-family: sans-serif;">All</option>
      <option val="2" style="font-family: serif;">Name</option>
      <option val="3" style="font-family: sans-serif;">Phone</option>
    </select>

    <select name="myselect2" style="font-family: sans-serif;">
      <option val="1">All</option>
      <option val="2">Name</option>
      <option val="3">Phone</option>
    </select>

    <select name="myselect3" style="font-family: serif;">
      <option val="1">All</option>
      <option val="2">Name</option>
      <option val="3">Phone</option>
    </select>
</body>
</html>

Also, be aware that, like Niet The Dark Absol already implied in his comment, all styling is ignored by touchscreens. No matter which browser is used.

此外,请注意,就像Niet The Dark Absol已经在他的评论中暗示的那样,触摸屏会忽略所有样式。无论使用哪种浏览器。