我目前的項目完全基於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