views:

31

answers:

3

Hi guys,

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>
            <option value="125" >Test1 - Test2</option>
            </select>
         </td>
      </tr>
   </table>
</body>
</html>
A: 

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"&gt;
<html>
<body>
....

Then it works as expected.

galambalazs
A: 

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

read this answer for solution:

http://stackoverflow.com/questions/492627/change-border-color-on-select-html-form

Haim Evgi
Thanks for the answer. I have put my <select> element in a <div> container and now it works!
Atticus
A: 

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

SLaks