【发布时间】:2014-10-09 06:22:50
【问题描述】:
我在我的 body 元素上设置了font-size: 12px。但在移动设备上,某些元素的字体大小超过 12 像素(例如,元素 p)。为什么会这样?如何解决这个问题?
body {
font: normal normal 400 12px/1.5 "Droid Sans", Helvetica, "Helvetica Neue", Arial, sans-serif;
}
.footer {
background: #1d3057;
padding: 15px 30px;
color: #dedede;
width: 100%;
box-sizing: border-box;
}
. footer span {
display: inline-block;
white-space: pre;
float: left;
font-size: 12px;
}
【问题讨论】:
-
移动设备会调整字体大小以提高可读性。您可以通过在 CSS 中定位移动设备来将其强制为所需的大小。 More information can be found in this answer.
-
为什么尺寸会在跨度中发生变化,并且仅在 Chrome 中有时会发生变化? 4 个 Chrome 中有 2 个不会改变大小。