The CSS letter-spacing
property is used to adjust letter spacing. While many units can be used, in some cases it is recommended that em
units be used.
The em
is a unit relative to the current font size. Therefore, specifying letter-spacing
in em
has the advantage that whenever the font size changes, the letter spacing will automatically adjust accordingly. This is useful for responsive design and design for different devices and viewport sizes.
Example: .
.text-example {
font-size: 16px;
letter-spacing: 0.05em; /* letter-spacing is 5% of font size */
}
Thus, the use of em
units makes it easier to maintain design consistency in a variety of situations. Of course, it is important to choose the best unit for your specific design requirements and context.