CSS - letter-spacing



The letter-spacing property specifies the space between the letters or characters that make up a word or text.

Possible Values

  • normal: Default value and represents the normal amount of space between letters.

  • length: Any specific length {pixels (px), points (pt), ems (em), or percentages (%)}.

  • initial: Sets the letter-spacing to its default value.

  • inherit: Allows to inherit the letter-spacing value from its parent element.

Note: Negative values are permitted.

Applies to

All the HTML elements.

DOM Syntax

object.style.letterSpacing = "5px;"

Example

Here is an example:

<html>
<head>
</head>
<body>
   <h2>Letter spacing</h2>
      <p style="letter-spacing: normal;">Letter spacing normal.</p>
      <p style="letter-spacing: 10px;">Letter spacing increased.</p>
      <p style="letter-spacing: -1px;">Letter spacing decreased.</p>
</body>
</html>
Advertisements