Home > Article > Web Front-end > Can css adjust the spacing between words and the left and right sides of the words?
css can adjust the spacing between words and words. In CSS, you can use the letter-spacing attribute to adjust the left and right spacing between words. The syntax is "letter-spacing: spacing value;"; this attribute allows the use of negative values, which can be increased or reduced by the positive or negative value of the attribute. Reduce the space between characters (character spacing).
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
css can adjust the spacing between words and the left and right sides of the words.
In CSS, you can use the letter-spacing attribute to adjust the left and right spacing between words.
The letter-spacing property can set the space between characters (character spacing).
Syntax format:
letter-spacing:间距值;
Spacing value: Defines the fixed space between characters.
Note:
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.
For this attribute: each Chinese character is regarded as a "character", and each English letter is also regarded as a "character"! So pay close attention.
The letter-spacing attribute allows the use of negative values, and the character spacing can be increased or decreased by the positive or negative value of the attribute.
Example:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <style type="text/css"> h1 { letter-spacing: 10px; } p{ letter-spacing: 2em; } div{ letter-spacing: -3px; } </style> </head> <body> <h1>This is header 1</h1> <p>这是一段文本!</p> <div>这是一段div文本!</div> </body> </html>
(Learning video sharing: css video tutorial, web front-end )
The above is the detailed content of Can css adjust the spacing between words and the left and right sides of the words?. For more information, please follow other related articles on the PHP Chinese website!