Paul Paul - 2 months ago 7
CSS Question

IE8 and border css property on select menus

I am getting a really strange behaviour when viewing a very simple piece of HTML in IE, served up by IIS. I am at a loss to explain this...

Take the following html

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

<html>
<head>
<style>
.iWantaBorder
{
border:red solid 1px ;
}
</style>
</head>
<body>
<select class="iWantaBorder">
<option>1</option>
</select>
</body>
</html>


Save as html file to your desktop.
When viewed in IE8, the select menu has a red border.

Now copy the file to a website or virtual directory in IIS 5.1 or IIS6.

Browse to that file in IE8... no red border.

Can anyone tell me what is going on here? I really want a border on this menu. Thought this should be simple to be honest, but I'm pretty much confused!

Answer

try putting this in your HEAD tag:

<meta http-equiv="X-UA-Compatible" content="IE=edge" >

as per: http://msdn.microsoft.com/en-us/library/cc288325%28VS.85%29.aspx

Comments