我已经弄清楚了:
Android 会根据辅助功能设置自动更改 HTML 文本大小。无需工作!
iOS 允许开发人员实现多个 CSS 类来更改 WebView
它的文本大小取决于 iOS 设备上的辅助功能设置。请点击这里了解更多 http://www.interactiveaccessibility.com/blog/text-resizing-web-pages-ios-using-dynamic-type
这些是课程:
-apple-system-headline
-apple-system-subheadline
-apple-system-short-headline
-apple-system-short-subheadline
-apple-system-body
-apple-system-short-body
-apple-system-tall-body
-apple-system-caption1
-apple-system-caption2
-apple-system-short-caption1
-apple-system-footnote
-apple-system-short-footnote
在您的 iOS 设备上访问此网站,查看课程内容 https://thepaciellogroup.github.io/IA-Coding-Patterns/iOS/text-resizing/ios-system-fonts.html
要使用 Apple 的预定义字体:p {font: -apple-system-body}
要使用您自己的字体:(您还可以使用以下命令创建您自己的字体系列@font-face
并引用它而不是 Arial!)
p {
font: -apple-system-body;
font-family: Arial, sans-serif;
font-weight: normal;
}
您可以使用以下属性:
font-family
font-weight
font-style
font-variant`
要使用您自己的字体大小:
p {
font: -apple-system-body;
font-family: Arial, sans-serif;
font-weight: normal;
}
.body-text-size {
font-size: 1.1em;
}
<p><span class="body-text-size>This is some text in my page.</span></p>
希望能帮助到你!
更新 04-2020:我注意到我的预览链接之一已失效。我通过找到托管该文件的另一个存储库来修复它。我已经链接了该链接,以防万一我的链接再次失效,我已将它们添加到网络存档中,以便您可以在那里找到它们! :)