Home  >  Article  >  Web Front-end  >  How to set character spacing in css

How to set character spacing in css

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-04-20 11:33:352361browse

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.

How to set character spacing in css

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:

How to set character spacing in css

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!

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
Previous article:How to hide labels in cssNext article:How to hide labels in css