0

I have two css IDs on different files, and I have to change the file with another only when the Program executes in Internet Explorer. I have this file called "custom.css":

#employee-list {
    border-bottom: 1px solid #c1c1c1;
    border-top: 1px solid #c1c1c1;
    height: initial;
}

I need (I must not modify custom.css) to set "height" to "auto". But only if the page is rendered on IE. So I created a second css file called "customie.css":

#employee-list {
    border-bottom: 1px solid #c1c1c1;
    border-top: 1px solid #c1c1c1;
    height: auto;
}

After that I wrote this Conditional Comment in the <head> of my MasterPage .cshtml.

<!--[if IE]>
    <link rel="stylesheet" type="text/css" href="customie.css" />
<![endif]-->

Problem is this: Conditional Comment doesn't work and the customie.css file overwrites the custom.css(which annuls itself) . How can I apply height: auto only for IE pages?

Thank you, Angelo

aingeal_brea
  • 103
  • 1
  • 1
  • 8

1 Answers1

0

No idea why the conditional isn't working, but you can achieve the desired effect using the CSS below. IE doesn't support initial, so it will fall back to auto instead.

#employee-list {
    border-bottom: 1px solid #c1c1c1;
    border-top: 1px solid #c1c1c1;
    height: auto;
    height: initial;
}
Maarten van Tjonger
  • 1,867
  • 1
  • 10
  • 15