HTML | DOM Style letterSpacing Property
The Style letterSpacing property in HTML DOM is used to set the space between the characters. This property allows to set the required space between characters and also used to returns the space between characters.
Syntax:
- It returns the letterSpacing property.
object.style.letterSpacing
- It used to set the letterSpacing property.
object.style.letterSpacing = "normal|length|initial|inherit"
Property Values:
- normal: The normal spacing for the current font i.e no extra space between characters. This is the default value.
- length: This mode specifies extra inter-character space in addition to the default space between the characters. Negative values are also allowed.
- initial: It sets the letterSpacing property to its default value.
- inherit: This property is inherited from its parent element.
Return Value: It returns a string that represents a space between the characters.
Example 1:
<!DOCTYPE html> <html> <head> <title> DOM Style letterSpacing Property </title> </head> <body> <center> <h1 style = "color:green;"> GeeksForGeeks </h1> <h2>DOM Style letterSpacing Property </h2> <p id = "GFG"> A computer science portal for geeks </p> <button type = "button" onclick = "geeks()"> Submit </button> <script> function geeks() { document.getElementById("GFG").style.letterSpacing = "8px"; } </script> </center> </body> </html> |
Output:
- Before Click on the button:

- After Click on the button:

Example 2:
<!DOCTYPE html> <html> <head> <title> DOM Style letterSpacing Property </title> </head> <body> <center> <h1 style = "color:green;"> GeeksForGeeks </h1> <h2> DOM Style letterSpacing Property </h2> <p id = "GFG"> A computer science portal for geeks </p> <button type = "button" onclick = "geeks()"> Submit </button> <script> function geeks() { document.getElementById("GFG").style.letterSpacing = "-1.5px"; } </script> </center> </body> </html> |
Output:
- Before Click on the button:

- After Click on the button:

Supported Browsers: The browser supported by DOM Style letterSpacing property are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Apple Safari
Recommended Posts:
- HTML | DOM Style top Property
- HTML | DOM Style right Property
- HTML | DOM Style transform Property
- HTML | DOM Style animationDelay Property
- HTML | DOM Style animationName Property
- HTML | DOM Style columnRuleStyle Property
- HTML | DOM Style outline Property
- HTML | DOM Style textAlignLast Property
- HTML | DOM Style order Property
- HTML | DOM Style backgroundImage Property
- HTML | DOM Style verticalAlign Property
- HTML | DOM Style flexGrow Property
- HTML | DOM Style flexWrap Property
- HTML | DOM Style listStyleImage Property
- HTML | DOM Style transitionDuration Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


