How to set the spacing between letters within a word in css

WBOY
Release: 2021-11-15 16:53:56
Original
4194 people have browsed it

In CSS, you can use the "letter-spacing" attribute to set the spacing between letters within a word. The function of this attribute is to increase or decrease the spacing between characters. You only need to add "{letter-spacing" to the text element. :spacing value;}" style is enough.

How to set the spacing between letters within a word in css

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

How to set the spacing between letters in a word using css

Create a new html file and name it test.html to explain how to adjust css The distance between English letters. In the test.html file, use the p tag to create a line of text for testing. Add "letter-spacing: interval size;" style to the p tag.

The letter-spacing property increases or decreases the space between characters (character spacing).

This 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.

The code is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
p{
     letter-spacing:15px;
}
</style>
  <head>
<body>
<p>you are beautiful</p>
</body>
</html>
Copy after login

Output result:
How to set the spacing between letters within a word in css

For more programming-related knowledge, please visit: Programming Video! !

The above is the detailed content of How to set the spacing between letters within a word 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!