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


To set letter spacing with CSS, use the em measurement unit.

A relative measurement of the height of a font is em spaces. Because an em unit is equivalent to the size of a given font, if you assign a font to 12pt, each "em" unit would be 12pt; thus, 2em would be 24pt.

Example

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

<html>
   <head>
   </head>
   <body>
      <div style = "position:relative;left:90px;top:3px;background-color:yellow;letter-spacing: 2em;">
         This div has relative positioning.
      </div>
   </body>
</html>

Lakshmi Srinivas
Lakshmi Srinivas

Programmer / Analyst / Technician

Updated on: 30-Jan-2020

659 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements