character spacing in css code example
Example 1: letter spacing css
div{
letter-spacing: 2px;
}
Example 2: line spacing css
line-height: 20px; /* 4px +12px + 4px */
/* OR */
line-height: 1.7em; /* 1em = 12px in this case. 20/12 == 1.666666 */
Example 3: letter spacing css
div{
letter-spacing: 2px;
}
Example 4: letter spacing css
.some-class {
letter-spacing: 3px;
}
Example 5: letter spacing css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Letter spacing in CSS</title>
<style>
.normal {
letter-spacing: normal;
}
.em-wide {
letter-spacing: 0.4em;
}
.em-wider {
letter-spacing: 1em;
}
.em-tight {
letter-spacing: -0.05em;
}
.px-wide {
letter-spacing: 6px;
}
</style>
</head>
<body>
<p class="normal">letter spacing</p>
<p class="em-wide">letter spacing</p>
<p class="em-wider">letter spacing</p>
<p class="em-tight">letter spacing</p>
<p class="px-wide">letter spacing</p>
</body>
</html>
Example 6: letter spacing in css
selector_name{
letter-spacing: 1px;
}