Letter Spacing using CSS

CSSWeb DevelopmentFront End Technology

To set space between letters i.e. characters, use the letter-spacing property. Following are the property values −

letter-spacing: normal|length|initial|inherit;

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
p.demo1 {
   letter-spacing: 1px;
}
p.demo2 {
   letter-spacing: 10px;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<h2>Heading2</h2>
<p class="demo1">This is demo text.</p>
<h2>Heading2</h2>
<p class="demo2">This is demo text.</p>
</body>
</html>

Output

Example

Let us now see another example −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
p.demo1 {
   letter-spacing: 1cm;
}
p.demo2 {
   letter-spacing: -2px;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<h2>Heading2</h2>
<p class="demo1">This is demo text.</p>
<h2>Heading2</h2>
<p class="demo2">This is demo text.</p>
</body>
</html>

Output

raja
Published on 26-Dec-2019 11:10:58
Advertisements