Icon font behaving strangely in IE11

此生再无相见时 提交于 2019-12-07 20:46:37

问题


I'm having a strange issue with an icon font misbehaving in IE... specifically, it seems that the browser is showing the icon associated with the lower-case character instead of the upper-case character. The characters in question are being specified in CSS using the content property of :before selectors.

For example, if we have CSS like:

.icon-1:before {
    content: 'o';
}

.icon-2:before {
    content: 'O';
}

and HTML like:

<div class='icon-2'></div>

we see the icon-1 icon instead of the icon-2 icon.

Does anyone have any suggestions as to how this could be happening? The icon font behaves correctly in other browsers, and even works correctly in my VM version of IE. I was only able to reproduce this using a colleague's Windows laptop.

Edit: This is happening on IE11, Windows 8.1.

Edit 2: Just found this, which may explain the behavior:

http://www.browserquirks.org/blog/2014/04/02/css-content-rule-is-not-case-sensitive-in-ie8-plus/


回答1:


Apparently when IE looks at CSS it ignores the casing. You can however add a text-transform property to fix the issue.

.icon-1:before {
    content: 'o';
}

.icon-2:before {
    content: 'O';
     text-transform: uppercase;
}

That should make the second one be uppercase and appear correctly on each browser.



来源:https://stackoverflow.com/questions/33086830/icon-font-behaving-strangely-in-ie11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!