伪元素大小的IE11不同(Pseudo-element size different on IE11

2019-10-20 21:46发布

在此现场演示 ,你可以看到一个图标,这是比任何其他正常的浏览器大几倍的IE浏览器11(FF /歌剧/铬)

大小必须是12 EM上的代码所看到的,但它的不同浏览器之间颇有几分:

.titlePanel [class^="icon-"]:before, 
.titlePanel[class*="icon-"]:before{     
    font-size: 12em;
    left: 79%;
    line-height: 100%;
    margin: 0 0 0 50px;
    position: absolute;
    z-index: -5000;   }

Answer 1:

由于在这一个对我们敬爱的IE的许多错误的解释,伪选择大小时应用多个CSS规则,如果有适用于伪选择多个选择:

https://connect.microsoft.com/IE/feedback/details/813398/ie-11-css-before-with-font-size-in-em-units-ignores-css-precedence-rules

为了避免这种情况我已经改变了,在这里看到的,包含在导航的伪选择一个规则,anothe单一的那些载于.titlePanel:

nav [class*="icon-"]:before,
nav [class*="iconH-"]:before {  
    float: right;    
    font-size: 2em;    
    line-height: 50%;
    margin: -5px 7px 0 0;
    position: relative;}

.titlePanel [class^="icon-"]:before{     
    font-size: 12em;
    left: 79%;
    line-height: 100%;
    margin: 0 0 0 50px;
    position: absolute;
    z-index: -5000;   }


文章来源: Pseudo-element size different on IE11