在chrome中,可以使用font: initial !important;
。但是在IE(9)中,它没有得到初始值。
我该如何解决这个问题?
任何版本的IE都不支持CSS3 initial
关键字
@Adrift完全正确,IE目前(IE11)不支持initial
。但要回答"我该如何解决这个问题?"…
font-style: normal;
font-variant: normal;
font-weight: normal;
font-stretch: normal;
font-size: medium;
line-height: normal;
font-family: serif; /* depends on user agent */
我刚刚遇到了line-height和min-height的错误。
在IE中,将"initial"替换为"auto"或"inherit"。例如:
/*IE*/
line-height: inherit !important;
/* Rest of the world */
line-height: initial !important;
/*IE*/
min-height: auto !important;
/* Rest of the world */
min-height: initial !important;
遗憾的是微软不接受font-size: initial
。
文档中指定的实际"initial"值是font-size: medium
。
Microsoft doc: https://msdn.microsoft.com/en-us/library/ms530759(v=vs.85).aspx
Mozilla doc: https://developer.mozilla.org/en-US/docs/Web/CSS/font-size