Wednesday, March 05, 2014

Fix: CSS border-radius not working in Internet Explorer 11

In doing browser compatibility testing in a new web form I was developing on my PC this morning, the form looked great in all browsers I had on my local Windows 8.1 PC – except for Internet Explorer 11, where it looked awful: div and form field border corners were squared instead of rounded, form fields rendered with excess height, some text was slightly truncated, and a few other issues.

When I looked at the CSS styles in use on the page in IE11’s built-in F12 developer tools, I noticed that the border-radius property on my form’s enclosing div was present, but it was missing its enable/disable checkbox, and the name of the style was shown with a red squiggle underline, as though IE didn’t recognize it.  It seemed almost as though IE11 was behaving like a legacy browser that didn’t recognize that newer CSS property.

In fact, that did turn out to be exactly the problem. IE11 was rendering the form (running on my local IIS) with its legacy “Compatibility View” engine, which it is by default configured to do for intranet sites.  (Oddly, my IE11 was not using Compatibility View to render another copy of the form that I was trying to use to debug the issue that I had IE loading via the “localhost” domain, which had me confused for a while.)

The solution was to disable IE11’s Compatibility View for intranet sites by doing Setting (gear icon) > Compatibility View Settings > uncheck “Display intranet sites in Compatibility View” checkbox.  Making that configuration change immediately got IE11 to start rendering the page properly.

46 comments:

  1. Thanks so much for this: you just saved my employer the cost of a new computer office window and possible lawsuit related to debris falling on the street below my office.

    ReplyDelete
  2. Thanks for the tip. I was having the same problem. I wonder how many tweaks I gave up using on the company's website just because it did not looked compatible on ie.

    ReplyDelete
  3. Yay - thank you!

    ReplyDelete
  4. Thanks a ton! Now if only other intranet users didn't have to go through this step :(

    ReplyDelete
  5. Hours I spent. Bloody hours. Why the clart was it rendering as IE5???? I'd buy you a drink if I could.

    ReplyDelete
  6. Thanks, this helped me as well! If I could ask a question, my ie is still not picking up my CSS styles though, how do I fix that, I tried: html data-useragent
    but still not working

    Any help would be appreciated

    ReplyDelete
  7. Thanks :-)

    Gracias, desactivandolo me funciono :)

    ReplyDelete
  8. Oh my god. You legend! Can not thank you enough!

    ReplyDelete
  9. Hello,

    thanks for the "“Compatibility View" hint, I didn't know that!

    A couple of weeks ago, I wrote about my work with iframes, border-radius and :hover:
    http://50226.de/about-google-maps-iframes-rounded-corners-hover-and-different-browsers.html

    The Internet Explorer 11 for example has generally no problems in displaying a border-radius in iframes. But the annoying thing is that it doesn't support :hover in iframes! Fortunately, there is a workaround, but you have to fall back to JavaScript.

    cheers,
    Witi

    ReplyDelete
  10. Not in a million years would I have thought of this. I figured it was some compatibility thing and was going nuts. Thanks!

    ReplyDelete
  11. Don't know if this will help anyone else but add this as the first tag in the head element.
    "meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" /"
    Replace the "" with <>
    Worked for me.

    ReplyDelete
    Replies
    1. THIS was the magic tag that made my page work. Thank you! I actually gasped when it worked. I've been fighting IE11 for two days. Gradients and rounded corners did not work until I set this meta tag.

      Delete
    2. Hey, now that is really something. While the solution provided in the article requires the user to do something (over which you have no control), your solution is simply the gem I was looking for as it does the job perfectly.

      Thank you Anonymous :)

      Delete
    3. This comment has been removed by the author.

      Delete
  12. I thought I have finally got the answer for hours I spent (even just realizing it was the border-radius), yet working with Windows 8.1 and Internet Explorer 11, I still have an X pattern that crosses over all elements with radius-border (with F12 tools, if I remove the border-radius the issue is fixed) also after following your tip. It doesn't happen with Chrome on that same OS.
    I am speaking from a user point-of-view, and hopefully someone has an insight about it.

    ReplyDelete
  13. Спасибо тебе добрый человек! Ты помог мне!

    ReplyDelete
  14. Thanks a lot!

    ReplyDelete
  15. Thank you very much!

    ReplyDelete
  16. Thank you!

    ReplyDelete
  17. Thank you for saving my sanity :)

    ReplyDelete
  18. Thanks so much. Excellent solution.

    ReplyDelete
  19. Please guide me on this.
    I am running my application on ie 11 and border-radius works only when i run the application in incompatibility mode and whenever I try to run the application in compatible mode the image is again squared.
    I am working on asp.net, vs2010.
    thanks

    ReplyDelete
  20. Thank you so much!

    ReplyDelete
  21. This trick didnt work for me. But I did noticed that the IE 11 dev tool emulator was set to emulate IE 8 behavior. Once I switched it to Edge, border-radius worked like a charm.

    ReplyDelete
    Replies
    1. omg, mine was set to IE5 which is probably why nothing worked for me. thank you so much for this, you have no idea how many hours i spent troubleshooting and wondering why some tips worked for everybody else but me. :)

      Delete
  22. than you, save my life

    ReplyDelete
  23. I forgot about this - thanks for saving me hours!

    ReplyDelete
  24. Awesome! Thanks so much!!!

    ReplyDelete
  25. Brilliant, I have wasted so much time on this, It also fixed a giggling issue I had with an asp:menu.

    Thanks.

    ReplyDelete
  26. Like many others...I thank you for saving my precious hair from being ripped out of my head.

    ReplyDelete
  27. Thanks a lot. I wish that this is the first post I read regarding this issue. That could have really saved me some valuable time

    ReplyDelete
  28. You're genius and even more so for posting this. Fixed me up right quick in a hurry like! One quick question though ... some pages NEED that compat mode, I don't see any way to list just a SINGLE page and NOT a whole website in the compat settings ... is there anyway you know of do just let a SINGLE page run in compat mode? Thanks again!!

    ReplyDelete
  29. I cannot begin to thank you enough! I have been toying with compatibility settings and changing css to no avail. All I needed to do was turn compatibility off!

    ReplyDelete
  30. I have wasted so much of time for this bloody problem.great thank you.

    ReplyDelete
  31. You rock!!!

    ReplyDelete
  32. Thanks!!!! This specifically didn't work for me because the inspector kept switching to IE8 but once I changed the version in the inspector it worked!! So much time wasted. Thanks again!

    ReplyDelete
  33. Thank you for that solution. Learnt something.

    ReplyDelete
  34. I spent hours on a solution, but you probably saved me many days, thank you.

    ReplyDelete
  35. Thank you very much! I had everything running under safari, chrome and firefox. All the sudden things stopped showing up different on IE 11 including functionality. This solved my problems!

    ReplyDelete
  36. Thanks man!

    ReplyDelete
  37. Great! It solved my problem too
    I wonder when sense to set it up from codebehind.

    ReplyDelete