CSS Common Properties Summary: The use of word-spacing and letter-spacing

Source: Internet
Author: User

The front-end time project version iterations, when the code was modified, was found to have used about word-spacing and letter-spacing. First of all, the use of the scene, the previous project, often encountered some characters between some spacing, I saw some colleagues of the code is so implemented:

<p> for </p>


if the distance is wider than a space, then add a few more, this method, although feasible, always feel that it is too violent, so I used CSS to achieve this effect, but also encountered in the middle of some problems previously not noticed, that's the difference between word-spacing and letter-spacing.

start oneself also want very simple, so direct use p{word-spacing:10px;}, and then directly embarrassed, without any effect, The main reason is still no scrutiny two differences between the first look at its syntax.

Letter-spacing

Syntax:
letter-spacing:normal | length
Parameters:
Normal: Default interval
Length: A value consisting of a floating-point number and a unit identifier that is allowed to be negative. See Length units
Description:
retrieves or sets the interval between the text in an object.
This property adds the specified interval to each text, but the last word is excluded.
the corresponding script attribute is letterspacing.

Word-spacing

Syntax:
word-spacing:normal | length
Parameters:
Normal: Default spacing
Length: A value consisting of a floating-point number and a unit identifier that is allowed to be negative. See Length units
Description:
retrieves or sets the number of spaces inserted between words in an object. Available only on Mac platforms for ie4+.
the corresponding script attribute is wordspacing.

Sum up: letter-spacing is the white space between each character, Word-spacing is the white space between the words,

The other has no effect, so the above is good explanation, Chinese characters under the word-spacing is no effect, so can only use letter-spacing.

CSS Common Properties Summary: The use of word-spacing and letter-spacing

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.