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.
Select a ratio (1.25, 1.333, 1.5) and a base size to generate a full typographic scale for h1‑h6. Copy CSS variables.
Apply user‑select: none, text, all and see how it affects selection. Copy the CSS snippet for your UI elements.
Toggle OpenType features like liga, smcp, tnum, and see the text update. Support for variable fonts. Typography nerds.
Paste long text and split it into 2, 3, or 4 balanced CSS columns. Preview and copy HTML/CSS. For magazine layouts.
Design a fully styled scrollbar with colors, width, and border radius. Get the CSS for Chrome and Firefox.
Test overscroll‑behavior: contain to prevent background scroll or pull‑to‑refresh. See the effect in a live demo.
Beautify and format your CSS stylesheets instantly. Organize, minify, or prettify CSS code for better readability. Processed securely on client-side.
Enter min and max font sizes and viewport widths to generate a perfect CSS clamp() expression. Fluid typography without media queries.
Define min and max font sizes and viewport widths. Generate a complete fluid type scale using CSS clamp() for all headings.
Design a pure CSS tooltip with custom text, position (top/bottom/left/right), and arrow. Copy the clean code.
Emojis are scrambled; you must reorder them to form the correct phrase or title. Fun word play.
Animate elements as they enter and exit the viewport using view() timeline. Parallax and reveal effects without JS.
A visual guide to common copy‑editing and proofreading symbols. Click a mark to see its meaning. For writers.
Make your JavaScript code more readable with this online beautifier. Format and indent JS automatically. Works entirely in your browser, protecting your code privacy.
Explore the new two‑value display syntax like `display: block flex`. See what each inner/outer pair does visually.
Set a short timer with a themed emoji animation (e.g., pizza cooking). A playful visual countdown.
Write expressions with clamp(), min(), max(), abs(), sign(), round() and see the computed value. Modern CSS calculations.
Test the new HTML popover attribute for creating accessible tooltips, menus, and dialogs without JavaScript. Copy code snippets.
Convert any date into Roman numerals (day‑month‑year) for tattoos or special occasions. Clean and local.
Generate a horizontal Code‑128 barcode from any string. Download as PNG or SVG. Works offline. For inventory.
A big button that triggers a colourful confetti cannon full‑screen. Use it to celebrate small wins. Pure joy.
Play the classic Snake game inside your browser. Arrow keys to move, eat the apple, grow longer. High score tracked locally.
Paste any JavaScript snippet and get a ready‑to‑drag bookmarklet link. Minify and encode automatically. Pure client.
Convert any date into Roman numerals (day‑month‑year) for tattoos or special occasions. Clean and local.
Select your racquet head size, string type, and play style to get a recommended tension range. Find your sweet spot.
Find equivalent colors across DMC, Anchor, and Madeira embroidery floss brands. Enter a code to see matches. Local reference database.
Write a JavaScript snippet and get a ready‑to‑drag bookmarklet link. With minification and encoding. Easy browser tools.
Calculate tips and split bills easily. Adjust tip percentage and number of people. Perfect for dining out. All computations happen on your device.
Add player names and tap +/- to track scores. Custom starting points. Works for any game.