Home >Web Front-end >CSS Tutorial >How to use css word-spacing attribute?

How to use css word-spacing attribute?

青灯夜游
青灯夜游Original
2019-02-21 14:36:095522browse

CSS word-spacing property is used to set the space between words or between words. Negative values ​​are allowed. When a negative value is set, the space between words is reduced, otherwise the space is increased.

How to use css word-spacing attribute?

CSS word-spacing property

Function: word The -spacing attribute increases or decreases the space between words. Allows specifying negative length values, which causes words to be squeezed closer together.

Description: The word-spacing attribute defines how many whitespace characters are inserted between words in the element. For this attribute, "word" is defined as a string surrounded by whitespace.

Syntax:

word-spacing:normal|length;

normal: Default value, defines the standard space between words, which is equivalent to setting it to 0.

length: Defines the fixed space between words, which will adjust the usual spacing between words.

Note: Negative values ​​are allowed. Taking advantage of the word-spacing property, it is possible to create documents with too widely spaced words, so be careful when using word-spacing.

Example of using CSS word-spacing attribute

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>php中文网(php.cn)</title> 
<style type="text/css">
p.spread {word-spacing: 20px;}
p.tight {word-spacing: -0.5em;}
</style>
</head>
<body>
<p class="spread">This is some text. This is some text.</p>
<p class="tight">This is some text. This is some text.</p>
</body>
</html>

Rendering:

How to use css word-spacing attribute?

Reference for this article: https://www.html.cn/book/css/properties/text/word-spacing.htm

The above is the detailed content of How to use css word-spacing attribute?. 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

Related articles

See more