Which Measurement Unit should be used in CSS to set letter spacing

To set letter spacing with CSS, use the em measurement unit for most cases, though other units like px and rem are also available depending on your needs.

The em unit is a relative measurement based on the font size of the current element. Because an em unit equals the size of the current font, if you assign a font to 12pt, each "em" unit would be 12pt; thus, 2em would be 24pt.

Why Use em for Letter Spacing?

Using em units makes letter spacing responsive and proportional to the font size. When the font size changes, the letter spacing automatically adjusts accordingly, maintaining consistent visual proportions.

Example with em Units

You can try to run the following code to use CSS to set letter spacing with em units:

<html>
  <head>
    <title>Letter Spacing Example</title>
  </head>
  <body>
    <div style="font-size: 16px; letter-spacing: 0.1em; margin: 20px;">
      Normal letter spacing with 0.1em
    </div>
    <div style="font-size: 16px; letter-spacing: 0.2em; margin: 20px;">
      Wider letter spacing with 0.2em
    </div>
    <div style="font-size: 24px; letter-spacing: 0.1em; margin: 20px;">
      Same 0.1em spacing but larger font
    </div>
  </body>
</html>

Alternative Units

While em is recommended, you can also use:

  • px - For fixed spacing regardless of font size
  • rem - Relative to the root element's font size
  • % - Percentage of the font size

Comparison Example

<html>
  <head>
    <title>Letter Spacing Units Comparison</title>
  </head>
  <body>
    <div style="font-size: 16px; letter-spacing: 2px; margin: 10px;">
      Fixed spacing: 2px
    </div>
    <div style="font-size: 16px; letter-spacing: 0.125em; margin: 10px;">
      Relative spacing: 0.125em
    </div>
    <div style="font-size: 24px; letter-spacing: 2px; margin: 10px;">
      Same 2px with larger font (looks cramped)
    </div>
    <div style="font-size: 24px; letter-spacing: 0.125em; margin: 10px;">
      Same 0.125em with larger font (proportional)
    </div>
  </body>
</html>

Conclusion

Use em units for letter spacing to maintain proportional spacing that scales with font size. This creates more consistent and responsive typography across different screen sizes and font configurations.

Updated on: 2026-03-15T23:18:59+05:30

961 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements