Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

initial-letter — CSS property

`initial-letter` specifies the size and sink of a paragraph initial letter.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

normal | [ <number> <integer>? ]

initial-letter specifies the size and sink of a paragraph initial letter.

The declaration applies to ::first-letter; the example compares paragraph height and reports the pseudo-element computed value.

The accepted grammar is normal | [ <number> <integer>? ]; global values still participate in the cascade.

The effect needs an eligible first letter, while exact metrics depend on the font and line height.

Examples

<!doctype html>
<html lang="en"><meta charset="utf-8"><title>CKTIS CSS reference example</title>
<body><div class="probe">probe</div><pre id="result"></pre><script>
document.body.innerHTML='<style>#x::first-letter{initial-letter:2 2}</style><p id="x">Alpha beta gamma delta</p><pre id="result"></pre>';const x=document.querySelector("#x");x.style.cssText="width:100px;font:16px/20px serif";document.querySelector("#result").textContent="paragraph-height="+Math.round(x.getBoundingClientRect().height)+"; computed="+getComputedStyle(x,"::first-letter").initialLetter;
</script></body></html>

Result

paragraph-height=60; computed=2 2

The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.

Sources