html - 如何防止windows文本缩放当前文档

标签 html css sass

有没有一种方法可以防止 Windows 文本在网页上缩放并显示未缩放的网页,即使 Windows 字体缩放到 125% 或 150%。

enter image description here

最佳答案

据我所知,当屏幕缩放级别增加时,唯一不会缩放的单位是视口(viewport)百分比单位(vhvw 以及那些基于这些)。这些可以设置为任何其他单位:

p {
  font-size: 2vw;
}

以下来自MDNs explanation on these units :

vh: Equal to 1% of the height of the viewport's initial containing block.

vw: Equal to 1% of the width of the viewport's initial containing block.

vmin: Equal to the smaller of vw and vh.

vmax: Equal to the larger of vw and vh.

要了解如何将这些用于文本,请参阅 CSS-Tricks on Viewport Sized Typography 上的一篇文章.它可能并不适合每个网站,但对于正确的用例来说肯定是可能的。

关于html - 如何防止windows文本缩放当前文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47474157/

相关文章:

html - Bootstrap Grid 系统在模态对话框中不起作用

sass - 如何使用 scss 选择 "self"但不完全编译的父选择器?

html - 当 <style> 标签被电子邮件客户端丢弃时,如何在电子邮件模板中应用打印样式表?

python - 无法在 TripAdvisor 中使用 Selenium 抢课

css - 在 Angular 2 中使用 md-grid-list 进行响应式设计

css - 在水平 sass susy 网格之间添加分隔线

css - 有没有办法使用 SCSS 向我的应用程序添加暗模式?

html - 无法获得跨度以换行

Javascript:为多个音频播放器和淡入淡出效果调整脚本

css - 绝对位置 div 在大小可变的列表项上