CSS 字间距

示例

word-spacing属性指定标签和单词之间的间隔行为。

可能的值

  • 正数或负数长度(使用em px vh cm等)或百分比(使用%)

  • 关键字normal使用字体的默认单词间距

  • 关键字inherit从父元素获取值

的CSS

.normal    { word-spacing: normal; }
.narrow    { word-spacing: -3px; }
.extensive { word-spacing: 10px; }

的HTML

<p>
  <span class="normal">This is an example, showing the effect of "word-spacing".</span><br>
  <span class="narrow">This is an example, showing the effect of "word-spacing".</span><br>
  <span class="extensive">This is an example, showing the effect of "word-spacing".</span><br>
</p>

在线演示

自己尝试

进一步阅读:

  • 字距-MDN

  • 字间距-w3.org