Letter Spacing in CSS

CSSWeb DevelopmentFront End Technology

The space between letters can be adjusted using the CSS letter-spacing property. The syntax of CSS letter-spacing property is as follows−

Syntax

Selector {
   letter-spacing: /*value*/
}

The following examples illustrate CSS letter-spacing property −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
div {
   box-shadow: 0 -10px 0 1px lightpink;
}
li {
   letter-spacing: 5px;
   line-height: 1.2em;
}
</style>
</head>
<body>
<h2>Demo Heading</h2>
<div>
<ol>
<li>This is demo text!</li>
<li>This is it!</li>
<li>This is another demo text!</li>
</ol>
</div>
</body>
</html>

Output

This gives the following output −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
dt {
   font-size: 20px;
   letter-spacing: -2px;
   word-spacing: 1em;
   color: white;
   font-style: italic;
   background-color: cadetblue;
}
dd {
   letter-spacing: 2pt;
}
</style>
</head>
<body>
<h2>Programming Languages and Databases</h2>
<dl>
<dt>Java</dt>
<dd>A programming language developed by James Gosling.</dd>
<dt>C++</dt>>
<dd>A programming language developed by Bjarne Stroustrup.</dd>
<dt>MySQL</dt>
<dd>MySQL is an open-source relational database management system.</dd>>>
</body>
</html>

Output

This gives the following output −

raja
Published on 06-Jan-2020 10:13:29
Advertisements