Setting Spaces between Letters with CSS letter-spacing Property

CSSWeb DevelopmentFront End Technology

Using the CSS letter-spacing property, we can specify the amount of space between letters of text.

Example

The following examples illustrate CSS letter-spacing property.

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
p:first-of-type {
   margin: 3%;
   padding: 3%;
   background-color: seagreen;
   color: white;
   letter-spacing: 2em;
   font-size: 2em;
   text-align: center;
}
</style>
</head>
<body>
<p>BOOM</p>
<p>BOOM</p>
</body>
</html>

Output

This will produce the following result −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
div {
   display: flex;
   margin: 3%;
   padding: 3%;
   border: 23px ridge navy;
}
p {
   margin: 3%;
   background-color: navajowhite;
   letter-spacing: 12px;
   font-size: 1.2em;
   text-align: center;
}
</style>
</head>
<body>
<div>
<p>BOOM</p>
<p>abcdefghijklmnop-qrstuvwxyz</p>
</div>
</body>
</html>

Output

This will produce the following result −

raja
Published on 12-Mar-2021 11:19:33
Advertisements