Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

CSS property `letter-spacing`

`letter-spacing` adds tracking between text characters or lets the browser use normal spacing.

Version: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review

Syntax

normal | <length>

letter-spacing adds tracking between text characters or lets the browser use normal spacing.

The example measures the same four-character text before and after adding 4px of spacing.

Grammar: normal | <length>.

Negative values can overlap glyphs; normal can participate in justification differently from explicit 0, and this property is not manual kerning.

Examples

<!doctype html><html lang="en"><meta charset="utf-8"><title>CKTIS CSS example</title><body><pre id="result"></pre><script>const x=document.createElement("span");x.textContent="MMMM";document.body.prepend(x);x.style.cssText="display:inline-block;font:20px sans-serif;white-space:nowrap;letter-spacing:0";const a=Math.round(x.getBoundingClientRect().width);x.style.letterSpacing="4px";const b=Math.round(x.getBoundingClientRect().width);document.querySelector("#result").textContent="width="+a+"->"+b+"; computed="+getComputedStyle(x).letterSpacing;</script></body></html>

Result

width=67->83; computed=4px

The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.

Sources