initial‑letter CSS Playground - Online Drop Caps
Style a drop cap using the initial‑letter property. Set size and sink. Modern alternative to pseudo‑element hacks.
UD5 Toolkit
initial-letter. This demo works best in Safari 9+ or Chrome 110+. The preview below shows the expected result where supported.
Typography is the art and technique of arranging type to make written language legible, readable, and appealing when displayed. The arrangement of type involves selecting typefaces, point sizes, line lengths, line spacing, and letter spacing, as well as adjusting the space between pairs of letters. The term typography is also applied to the style, arrangement, and appearance of the letters, numbers, and symbols created by the process.
p {
initial-letter: 3;
}
p::first-letter {
color: #8b0000;
font-family: 'Georgia', serif;
font-weight: bold;
}
initial-letter?
initial-letter is a CSS property that automatically creates a drop cap (or raised cap) effect — where the first letter of a block of text spans multiple lines. It's part of the CSS Inline Layout Module Level 3. With a single value like initial-letter: 3;, the first letter will span 3 lines. This replaces the older, hackier methods involving float, manual font-size adjustments, and line-height calculations.
initial-letter?
Supported:
Not yet supported:
For unsupported browsers, consider using a @supports fallback with the traditional float method.
initial-letter: 3; (single value) = the first letter spans 3 lines, with its baseline aligned to the bottom of the 3rd line. This is the most common usage.initial-letter: 3 2; (double value) = the first letter still spans 3 lines of height, but its baseline aligns to the 2nd line instead. The letter "sinks" less, creating a raised cap effect with text potentially wrapping into the space below the letter (depending on initial-letter-wrap). The sink value must be ≤ the size value.
::first-letter work with initial-letter?
initial-letter property is applied directly to the block-level container (like p). You can then use the ::first-letter pseudo-element to style the drop cap's appearance — its color, font-family, font-weight, background-color, and more. The initial-letter handles the sizing and alignment automatically, so you generally shouldn't override font-size on ::first-letter when using initial-letter.
@supports to provide a float-based fallback:
p::first-letter {
float: left;
font-size: 4.5em;
line-height: 0.85;
margin-right: 0.08em;
}
@supports (initial-letter: 3) {
p::first-letter {
float: none;
font-size: inherit;
line-height: inherit;
}
p { initial-letter: 3; }
}
initial-letter-wrap?
initial-letter-wrap controls how surrounding text wraps around the drop cap's contours:
Style a drop cap using the initial‑letter property. Set size and sink. Modern alternative to pseudo‑element hacks.
Style the first letter of a paragraph as a large decorative drop cap. Choose font, color, and size. Get the CSS & HTML.
Build a complete font‑stack for your website. Choose a primary font and get the best fallback options for different OS. Copy the CSS.
New CSS text‑spacing property for fine control over punctuation spacing. See the effect live. For advanced typography.
Toggle OpenType features like liga, smcp, tnum, and see the text update. Support for variable fonts. Typography nerds.
Compare break‑all, keep‑all, and overflow‑wrap: anywhere/break‑word. Paste long words and see how they wrap.
Create outlined text with the text‑stroke property. Adjust width and color. Preview and copy the CSS.
Paste your full CSS and HTML; automatically identify and extract the styles needed for the visible part. Reduce render‑blocking resources.
See which fonts map to generic families (serif, sans‑serif, monospace) on different operating systems. A handy reference.
Apply East Asian glyph variants like jis78, proportional-width, ruby. See the difference instantly. For CJK typography.
Create vertically oriented text layouts with `writing‑mode`. See the effect and copy the complete CSS. For vertical languages.
Create seamless CSS background patterns like stripes, polka dots, checkerboard. Adjust size and colors. Copy the tiny CSS.
Create glowing, neon‑style text effects with multiple text‑shadows. Adjust colors and intensity. Copy the CSS.
Design a custom focus indicator with outline, offset, and box‑shadow. Preview on interactive elements. Copy the CSS.
Choose tabular‑nums, diagonal‑fractions, ordinal and see the effect on a numeric list. Elegant data presentation.
Style underlines, overlines, and strike-throughs with colors, wavy styles, and thickness. Modern CSS text‑decoration.
Visually name grid areas in a table and generate grid‑template‑areas CSS. Perfect for complex layouts. Drag‑free.
Detect browser support for font‑tech() and font‑format() values in @font‑face src. Check COLRv1, variable, etc.
Create a 5‑star rating widget using only HTML and CSS. Customize colors and size. Copy the clean code.
Apply the drop‑shadow() filter and compare it with box‑shadow. See how it follows the contour of transparent images. Copy code.
Toggle scroll‑behavior: smooth and click anchor links to see the scrolling animation. Implement modern UX.
Animate elements as they enter and exit the viewport using view() timeline. Parallax and reveal effects without JS.
See the difference between :focus and :focus‑visible on interactive elements. Learn which to use for better UX.
Design a realistic neon sign text with multiple layers of glow. Copy the CSS and HTML. Perfect for headers.
Define a set of colors for light and dark themes. Get the CSS custom properties snippet. Toggle live.
Select emojis and arrange them into a seamless tiling background. Copy the CSS data‑URI or download as image.
Beautify and format your CSS stylesheets instantly. Organize, minify, or prettify CSS code for better readability. Processed securely on client-side.
Toggle between light and dark mode for a demo page. See how to use the media query. Copy the pattern.
Test different line‑break and word‑break values on Chinese/Japanese/Korean text. See how browsers wrap. Essential for i18n.
Paste plain text and turn it into a nested outline using indent levels or Markdown headings. Great for planning.