CSS Reference ยท Typography
The initial-letter property
Reference for the CSS initial-letter property: make drop caps and raised initials with ::first-letter. Syntax, live example, fallbacks and browser support.
The initial-letter property styles the first letter of a block as an initial: a large capital that spans several lines. It handles the hard part of drop caps for you: sizing the letter so its top lines up with the top of the first line and its baseline with a lower line, and wrapping the text around it.
Before this property, drop caps were built with float, magic font sizes and manual tweaks that broke whenever the font changed. initial-letter is the clean solution, but its support is not complete, so always plan a fallback.
p::first-letter { initial-letter: 3; }
Try it
In a browser that supports the property, the capital "E" is three lines tall and the text flows around it. In other browsers you still see a bold, coloured first letter at normal size, because the other declarations are valid on their own.
Syntax
initial-letter: normal | <number> <integer>?;
| Initial value | normal |
| Applies to | ::first-letter pseudo-elements and inline-level first children of a block container |
| Inherited | no |
| Animatable | no |
| Computed value | as specified |
Values
| Value | Description |
|---|---|
normal |
No special initial letter: the letter has the same size as the text. |
<number> |
The height of the initial in lines of text. It can be fractional, for example 2.5. It must be at least 1. |
<number> <integer> |
Height in lines, then how many lines the letter sinks into the paragraph. The sink value is a whole number of at least 1. A value of 3 3 is a classic drop cap; 3 1 makes a raised initial that sits on the first line and reaches above it. |
When you give just one number, you get a regular drop cap that sinks by the same number of lines.
Usage notes
- Apply it to
::first-letter. It also works on an inline element at the start of a paragraph, such as a<span class="initial">, which is useful when you need to target something other than the first typographic letter. - Choose a font with a good cap height. The browser aligns using font metrics, so the result depends on the font. Test with the actual font.
- Margins and colour. Adjust the space beside the letter with a margin on the pseudo-element. You can also change colour and weight there.
- Fallback. Provide a harmless fallback style outside any
@supportsrule, or wrap the experiments in@supports (initial-letter: 3). Do not build a float-based fallback unless you also exclude supporting browsers, or both techniques will stack. - Accessibility. Screen readers read the paragraph normally; the initial is only visual. Keep the letter's colour contrast high.
- Don't overuse. One drop cap at the start of a chapter or article is enough.
Browser support
Limited. Some Chromium-based browsers and Safari (which may need a -webkit- prefix) support it, while other browsers did not at the time of writing. Check a compatibility table and keep the fallback.
Related
::first-letterโ the pseudo-element used to target the initialfloatโ the older drop-cap techniqueline-heightโ sets the size of each line the initial spans- Lesson: Pseudo-elements