Css letter-spacing

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.