我目前的项目完全基于ems。CSS:以ems计算:font-size内的字体大小?
HTML
<div class="tiny">
This is some tiny text which is tiny.
</div>
<div class="small">
This is some small text which is small.
<div class="tiny">
And this is some tiny text inside small text which should be as tiny as the other tiny one.
</div>
</div>
CSS
.tiny {
font-size:0.7em;
line-height:1.7;
}
.small {
font-size:0.8em;
line-height:1.3em;
}
在这种情况下,文本small
内的tiny
文本比正常tiny
文本小。
首先,为什么?其次,我怎样才能解决这个问题,或使它的大小相同?
预先感谢您!
由于您标记了您的问题[css3],因此您可以使用'rem',因此它始终相对于根元素的字体大小,而不是父元素。当然,浏览器的支持并不是那么好,所有... – BoltClock 2012-08-02 17:07:16
'rem'完成了这项工作!真棒! – matt 2012-08-02 17:40:36