CSS
Spacing
There are two types of spacing properties in CSS.
- Letter Spacing
- Word Spacing
Letter Spacing
The letter-spacing defines the spacing between the characters of a block of text.
Syntax:
p{
letter-spacing: 3px;
}
Example:
<!doctype html>
<html>
<head>
<title>...</title>
</head>
<body>
<p style="letter-spacing: 3px;">You can learn programming languages from PHPDocs.</p>
</body>
</html>
Word Spacing
The word-spacing defines the length of space between words and tags.
Syntax:
p{
word-spacing: 3px;
}
Example:
<!doctype html>
<html>
<head>
<title>...</title>
</head>
<body>
<p style="word-spacing: 3px;">You can learn programming languages from PHPDocs.</p>
</body>
</html>
Units
The possible units can be used for these properties are as follows:
Values | Description |
---|---|
pixel | Values with “px” e.g. 3px, 4px |
rem | Values with “rem” e.g. 1rem, 6rem |
normal | It alters the space between characters in order to justify text. |