css - CSS中的响应字体大小

标签 css responsive-design zurb-foundation font-size

我使用 Zurb Foundation 3 网格创建了一个站点。每个页面都有一个大的h1:

body {
  font-size: 100%
}

/* Headers */

h1 {
  font-size: 6.2em;
  font-weight: 500;
}
<div class="row">
  <div class="twelve columns text-center">
    <h1> LARGE HEADER TAGLINE </h1>
  </div>
  <!-- End Tagline -->
</div>
<!-- End Row -->

当我将浏览器调整为移动尺寸时,大字体不会调整,并导致浏览器包含水平滚动以适应大文本。

我注意到在 Zurb Foundation 3 版式上 example page , header 在压缩和扩展时适应浏览器。

我是否漏掉了一些非常明显的东西?我如何实现这一点?

最佳答案

您可以使用视口(viewport)值代替 ems、pxs 或 pts:

1vw = 1% of viewport width

1vh = 1% of viewport height

1vmin = 1vw or 1vh, whichever is smaller

1vmax = 1vw or 1vh, whichever is larger

h1 {
  font-size: 5.9vw;
}
h2 {
  font-size: 3.0vh;
}
p {
  font-size: 2vmin;
}

来自 CSS 技巧: Viewport Sized Typography

关于css - CSS中的响应字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41708287/

相关文章:

HTML 选择标签动画的选项

css - Bootstrap 2.3.2 干扰 Google map 控件 v.3

html - 在 HTML 中使用 Bootstrap

reference - "Foundation - ReferenceError: primordials is not defined when starting a foundation zurb project."

html - 使用 Foundation 自定义菜单

javascript - 如何让 bootstrap tabs-left 在 bootstrap 3.3.x 中工作

css - 为什么在浏览器中打开网站时没有任何显示?

javascript - 基于设备的 HTML 响应式链接

jquery - 我什么时候应该进行延迟加载?这将如何影响谷歌搜索结果?

Javascript 与 jQuery 或 Javascript 一起淡入