letter-spacing
Description
letter-spacing
defines the amount of whitespace between the characters.
Item | Value |
---|---|
Initial value | normal |
Inherited | No. |
Version | CSS1 |
JavaScript syntax | object.style.letterSpacing="3px" |
Applies to | All elements. |
Syntax and Property Values
letter-spacing: length | normal | inherit
The property values are listed in the following table.
Value | Description |
---|---|
normal | Default value. No extra space between characters. |
length | Set an extra space between characters and negative values are allowed |
inherit | Inherit the letter-spacing property from the parent element |
Example
The following code uses px
and em
based value to set letter_spacing
.
p {letter-spacing: 6px;}
em {letter-spacing: 0.2em;}
p {letter-spacing: -0.5em;}
<!DOCTYPE HTML>
<html>
<head>
<style>
p {<!--from w ww.j a v a 2 s . c o m-->
letter-spacing: -2px;
}
</style>
</head>
<body>
<p>
Two pixels of space have been
subtracted from between each letter.
</p>
</body>
</html>
The code above generates the following result.