Definition and usage
The letter-spacing attribute adds or removes spaces (character spacing) between characters ).
This attribute defines how much space is inserted between text character boxes. Because the font is usually narrower than its character box, the normal interval between letters is adjusted when the length value is specified. Therefore, normal is equivalent to 0.
Note: negative values are allowed, which makes letters more tight.
Default value: normal
Inheritance: yes
Version: CSS1
JavaScript syntax: object. style. letterSpacing = "3px"
Instance
Set the letter spacing between h1 and h2 elements:
The code is as follows: |
Copy code |
H1 {letter-spacing: 2px} H2 {letter-spacing:-3px} |
TIY
Example:
The code is as follows: |
Copy code |
Div {letter-spacing: 6px ;} Div {letter-spacing: 0.5pt ;} |
Note:
1. The use of letter-spacing only applies to text, and the image is invalid.
2. Use letter-spacing to separate Chinese characters with one word.
3. Use letter-spacing to display the real-time effect in dreamweaver.
Browser support
All browsers support the letter-spacing attribute.
Note: Any version of Internet Explorer (including IE8) does not support the attribute value "inherit ".
Possible value
Value description
Normal default. There is no extra space between specified characters.
Length defines the fixed space between characters (negative values are allowed ).
Inherit specifies that the value of the letter-spacing attribute should be inherited from the parent element.
Note:
The letter-spacing and word-spacing attributes are used to add spaces in their corresponding elements. Letter-spacing adds spaces between letters, while word-spacing adds spaces between words. Please note that word-spacing is invalid for Chinese