Text properties control how text is laid out.
| Property | Example values |
|---|---|
text-align |
left, center, right, justify |
text-decoration |
none, underline, line-through |
text-transform |
uppercase, lowercase, capitalize |
line-height |
1.6 |
letter-spacing |
2px |
word-spacing |
6px |
text-indent |
30px |
text-shadow |
2px 2px 4px gray |
A line-height of about 1.5–1.7 makes paragraphs easy to read.
Example
Example — Text properties
HTML
<style>
h2 { text-align: center; text-transform: uppercase; letter-spacing: 3px; }
.shadow { text-shadow: 2px 2px 4px #999; font-size: 24px; }
.through { text-decoration: line-through; color: gray; }
p { line-height: 1.7; }
</style>
<h2>Text styling</h2>
<p class="shadow">Text with a shadow</p>
<p class="through">Old price: ₹999</p>
<p>A comfortable line height makes long paragraphs much easier to read on any screen.</p>