::first-letter
W3C CSS Snapshot 2026
Style the first letter of the first formatted line in a block of text.
On this page
Syntax and values
| Value or syntax | What it does |
|---|---|
p::first-letter | Targets the first letter and can include adjoining punctuation. |
Try the example
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>::first-letter</title>
<style>
p::first-letter { color: teal; font-size: 1.7em; }
</style>
</head>
<body>
<p class="notice">Registration opens Monday.</p>
<p id="location">Meet in Room 2.</p>
<h2>Workshop</h2>
</body>
</html>
What to expect The initial letter in each paragraph is larger and teal.