【发布时间】:2019-12-08 06:58:43
【问题描述】:
我使用Bootstrap 处理一个网络项目,但我在字体大小方面遇到了一些问题。
尝试在 chrome 中运行此HTML sn-p,然后在具有 移动视图(如 iPhone 7)的 Firefox 中运行:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
html {
font-size: 40px;
font-size-adjust: none;
}
h1 {
font-size: 2rem;
}
</style>
</head>
<body>
<div>
<h1>
test
</h1>
</div>
<button type="button" class="btn btn-primary">Send</button>
</body>
</html>
您会看到,在 Firefox 移动视图中,字体大小比在 chrome 下大得多。但是,我将<html> 的字体大小初始化为像素值(此处为40px),然后我只使用rem 具有字体大小值(引导程序也使用rem 值作为字体大小)。
为什么渲染效果如此不同?
【问题讨论】:
标签: html css google-chrome firefox