我正在尝试使用 font-size:0;
hack 来消除网格系统上的空白区域。
我已将主体字体大小设置为 0,然后在其他地方指定我的文本的大小。
然而 font-size:0;似乎覆盖了并且看不到我的文本?
div{font-size:0;}
h1{font-size:1.5em;}
最佳答案
em
值是相对于父元素上的字体大小定义的。因此,在这种情况下,1.5em;
的计算值将是 0
。
你可以use a root-em rem
或 fixed length value as px
.
15.7 Font size: the 'font-size' property
'em' and 'ex' length values refer to the computed font size of the current element. On the 'font-size' property, these length units refer to the computed font size of the parent element.
关于html - 字体大小覆盖其他样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25622076/