良好的排版能显著提升阅读体验。正文行高建议在 1.6 到 1.9 之间,段落之间保留适当间距。

本节要点

  • font-family 可以设置多个字体作为回退。
  • line-height 使用无单位数值,会按字号自动计算。
  • text-overflow: ellipsis 配合 overflow 和 white-space 实现单行省略。

代码示例

.article p {
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: .01em;
  color: #334155;
}

.title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}