How to adjust Chinese text spacing in css

青灯夜游
Release: 2022-01-20 16:56:35
Original
8890 people have browsed it

In CSS, you can use the letter-spacing attribute to adjust the spacing between Chinese characters. The function of this attribute is to increase or decrease the space between characters, that is, to set the character spacing; you only need to add "letter" to the Chinese text elements. -spacing: spacing value" style is enough.

How to adjust Chinese text spacing in css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

In CSS, you can use the letter-spacing attribute to adjust the spacing of Chinese characters.

The letter-spacing attribute can increase or decrease the space between characters, that is, set the character spacing.

The letter-spacing property defines how much space is inserted between text character boxes. Because character glyphs are typically narrower than their character boxes, specifying a length value adjusts the usual spacing between letters. Therefore, normal is equivalent to a value of 0.

Note: Negative values ​​are allowed, which will squeeze the letters closer together.

Example:

<!DOCTYPE html>
<html>
	<head>
		<style type="text/css">
			.css2 {
				letter-spacing: 1em;
			}
			.css3 {
				letter-spacing:-3px;
			}
		</style>
	</head>

	<body>
		<p class="css1">这是一段文字,正常字间距</p>
		<p class="css2">这是一段文字,字间距为1em</p>
		<p class="css3">这是一段文字,字间距为-3px</p>
	</body>

</html>
Copy after login

How to adjust Chinese text spacing in css

(Learning video sharing: css video tutorial)

The above is the detailed content of How to adjust Chinese text spacing in css. 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