Home  >  Article  >  Web Front-end  >  What is the difference between letter-spacing and word-spacing?

What is the difference between letter-spacing and word-spacing?

零下一度
零下一度Original
2017-06-19 14:34:583274browse

Syntax:
letter-spacing: normal | length
Parameters:
normal: Default spacing
length: A length value consisting of a floating point number and a unit identifier , negative values ​​are allowed. See Length Units
Description:
Retrieve or set the spacing between text in the object .
The attribute will add the specified space after each word, but the last word will be excluded.
The corresponding script feature is letterSpacing. Please see other books I have written.
Example:

div {letter-spacing:6px; } 
div {letter-spacing:0.5pt; }

What is the difference between letter-spacing and word-spacing

CSS Medium word-spacing attribute
1. Retrieve or set the number of spaces inserted between words in the object. A length value consisting of a floating point number and a unit identifier. Negative values ​​are allowed.
2. The default value is normal, which is equivalent to setting it to 0
3. CSS defines "word" as a string composed of any non-whitespace characters and surrounded by some kind of whitespace characters. This definition has no actual semantics, it just assumes that a document contains words surrounded by one or more whitespace characters. User agents that support CSS cannot necessarily determine which words are legal in a given language and which are not. Although this definition is of little value, it does mean that hieroglyphic languages ​​or non-Roman scripts often cannot specify word spacing.
4. Using this attribute, you may create a document with too wide word spacing, so be careful when using word-spacing.

2. Letter-spacing attribute in CSS
1. Set the spacing between the text in the object. Each Chinese text and English letter are separated by the set distance. This The attribute controls the word spacing. Its attribute value is applicable to both Chinese and English
2. The default value is normal, which is equivalent to setting it to 0
3. Letter-spacing only works on text for picturesInvalid
4. Use letter-spacing to space Chinese characters with one word and English with one letter.

The word-spacing attribute increases or decreases the space between words (i.e. word spacing).

The letter-spacing property increases or decreases the space between characters (character spacing).

word-spacing(即字间隔):
This    is    some    text.    This    is    some    text.
This is some text. This is some text.
letter-spacing (字符间距):
T    h    i    s     i    s    h    e    a    d    e    r 4

The above is the detailed content of What is the difference between letter-spacing and word-spacing?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn