How to use css word-spacing attribute?

青灯夜游
Release: 2020-09-08 14:36:37
Original
5335 people have browsed it

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;
Copy after login

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>
Copy after login

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!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!