Home > Article > Web Front-end > How to set character spacing in css
In CSS, you can use the "letter-spacing" attribute to set the word spacing, the syntax is "letter-spacing: spacing value". The letter-spacing property increases or decreases the space between characters. This property defines how much space is inserted between text character boxes.

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
In CSS, the attribute that adjusts the spacing between words is letter-spacing. You set the spacing between words in the label by changing the value of the letter-spacing attribute of the label.
Example:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>document</title>
<style>
h1 {
letter-spacing:2px;
}
h2 {
letter-spacing:-3px;
}
</style>
</head>
<body>
<h1>这是一段文字</h1>
<h2>这也是一段文字</h2>
</body>
</html>Result:

Recommended learning:css video tutorial
The above is the detailed content of How to set character spacing in css. For more information, please follow other related articles on the PHP Chinese website!