开发者

IE 8 select class problem

It looks like I am having a css problem in IE 8. The code below runs on FF without a problem. However it seems that in IE 8 the css style is not applied to the select element. Do you know what could cause the problem in IE 8? I want it to be compatible with both browsers.

Here's the code:

<html>
<body>
   <style type="text/css">
   .highlight{
      border-style: solid;
      border-width: 2px;
      border-color: #FF0000;
   }
   </style>
   <table>
      <tr>
         <td>
            <select class="highlight" >
            <option></option>
            <opti开发者_StackOverflow社区on value="125" >Test1 - Test2</option>
            </select>
         </td>
      </tr>
   </table>
</body>
</html>


the problem is change the border color on a element in ie.

read this answer for solution:

Change border color on <select> HTML form


You should use a doctype for your HTML.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
<body>
....

Then it works as expected.


<select> elements cannot be reliably styled in all browsers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜