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

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>
Updated on: 2020-01-30T08:45:13+05:30

865 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements