2010-10-14 26 views

回答

4

正如W3C CSS2 Fonts文件中提到:

<relative-size> 
A <relative-size> keyword is interpreted relative to the table of font sizes 
and the font size of the parent element. Possible values are: [ larger | smaller ]. 
For example, if the parent element has a font size of 'medium', a value of 'larger' 
will make the font size of the current element be 'large'. If the parent element's 
size is not close to a table entry, the UA is free to interpolate between table 
entries or round off to the closest one. The UA may have to extrapolate table values 
if the numerical value goes beyond the keywords. 

低于这个,说:

Note 2. In CSS1, the suggested scaling factor between adjacent indexes was 1.5, which 
user experience proved to be too large. In CSS2, the suggested scaling factor for a 
computer screen between adjacent indexes was 1.2, which still created issues for the 
small sizes. Implementation experience has demonstrated that a fixed ratio between 
adjacent absolute-size keywords is problematic, and this specification does not 
recommend such a fixed ratio. 

我希望这回答了你的问题。

1

根据SitePoint Reference,你的猜测是完全正确的。大多数浏览器会将字体大小增加1.2em,但他们没有这样做的标准。

W3C的建议是,您使用em或%进行尺寸调整,因为页面上的元素大小将相互关联,而不依赖于某些不常用的浏览器中可能不使用的任意约定。

0

font-size:larger将导致所选元素的字体大小大于其父容器中的字体大小。 CSS的标准字体大小是中等的。实际的pxem值取决于客户端/浏览器。通常它是1em,常见的转换是1em = 16px。