在 Firefox 中渲染文本区域字段时,我遇到了一个非常不寻常的问题。到目前为止,我还没有在 Mac 上测试过 18.0 以外的其他版本。
我的问题是,字体大小总是相对于 13px(操作系统默认值)而不是它的父级的 16px。如果我为它的父级定义一个固定的字体大小,它会按预期工作。但是,如果所有父母都有一个相对的字体大小,那么 textarea 的字体大小只是相对于我的操作系统默认值。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Test Firefox ..</title>
<style>
/* Fixed sizes */
/* body { font-size: 12pt; } */
/* body { font-size: 16px; } */
/* body { font-size: 0.4234cm; } */
/* Dynamic sizes */
/* body { font-size: 1em; } */
/* body { font-size: 100%; } */
/* body { font-size: medium; } */
textarea { font-size: 1em; }
</style>
</head>
<body>
<textarea rows="4" cols="20">abc</textarea>
</body>
</html>
类似的问题,但不包括我的情况:Why <textarea> and <textfield> not take font-family and font-size from body?
任何人之前都经历过类似的事情,或者可以在其他浏览器(版本)或操作系统中确认这种行为?
编辑:这是 jsfiddle.net 上的代码:http: //jsfiddle.net/E4WwV/