Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How does CSS set word spacing?


May 29, 2021 Article blog



In a development web page, when you encounter a font that is too compact and affects the beauty of the page, you need to use CSS to set its word spacing. So in this article, the W3Cschool editor-in-chief teaches you how CSS sets word spacing.

letter-spacing: Increases or decreases the white space (character spacing) between characters.

To achieve the effect:

 How does CSS set word spacing?1

Specific code:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>字符间距 - 编程狮(w3cschool.cn)</title>
	<style type="text/css">
		.one{
			letter-spacing: 3px;/*字符间距增加3px*/
		}
		.two{
			letter-spacing: -3px;/*字符间距减少3px*/
		}
	</style>
</head>
<body>
	<p>这是正常的间距</p>
	<p class="one">这是增加间距</p>
	<p class="two">这是减少间距</p>
</body>
</html>

That's all CSS says about how to set character spacing.