Spec-Zone.ru › CSS

`initial-letter` CSS property

Baseline Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The initial-letter CSS property sets the size and sink for dropped, raised, and sunken initial letters. This property applies to ::first-letter pseudo-elements and inline-level first children of block containers.

Syntax

/* Keyword values */
initial-letter: normal;

/* One value */
initial-letter: 3; /* 3 lines tall, baseline at line 3 */
initial-letter: 1.5; /* 1.5 lines tall, baseline at line 2 */

/* Two values */
initial-letter: 3 2; /* 3 lines tall, baseline at line 2 (raised 1 line) */
initial-letter: 3 1; /* 3 lines tall, baseline unchanged (raised 2 lines) */

/* Global values */
initial-letter: inherit;
initial-letter: initial;
initial-letter: revert;
initial-letter: revert-layer;
initial-letter: unset;

Values

This property is specified as normal or a <number> optionally followed by an <integer>:

normal
No special initial-letter effect. Text behaves as normal.
<number>
Defines the size of the initial letter, in terms of how many lines it occupies. Negative values are not allowed.
<integer>
Defines the number of lines the initial letter should sink when the size of it is given. Values must be greater than zero. If omitted, it duplicates the size value, floored to the nearest positive whole number.

Formal definition

Initial value normal
Applies to ::first-letter pseudo-elements and inline-level first child of a block container
Inherited no
Computed value as specified
Animation type by computed value type

Formal syntax

initial-letter = 
  normal |
  [ <number> <integer>? ]

<integer> = 
  <number-token>

Examples

Setting initial letter size

HTML

<p class="normal">Initial letter is normal</p>
<p class="onefive">Initial letter occupies 1.5 lines</p>
<p class="three">Initial letter occupies 3 lines</p>

CSS

.normal::first-letter {
  -webkit-initial-letter: normal;
  initial-letter: normal;
}

.onefive::first-letter {
  -webkit-initial-letter: 1.5;
  initial-letter: 1.5;
}

.three::first-letter {
  -webkit-initial-letter: 3;
  initial-letter: 3;
}

p {
  outline: 1px dashed red;
}

Result

Setting the sink value

In this example, all the initial letters are the same size, but with different sink values.

HTML

<p class="four">Initial letter: Sink value = 4</p>
<p class="same">Initial letter: Sink value not declared (same as size)</p>
<p class="two">Initial letter: Sink value = 2</p>
<p class="one">Initial letter: Sink value = 1</p>

CSS

.four::first-letter {
  -webkit-initial-letter: 3 4;
  initial-letter: 3 4;
}

.same::first-letter {
  -webkit-initial-letter: 3;
  initial-letter: 3;
}

.two::first-letter {
  -webkit-initial-letter: 3 2;
  initial-letter: 3 2;
}

.one::first-letter {
  -webkit-initial-letter: 3 1;
  initial-letter: 3 1;
}

p {
  outline: 1px dashed red;
}

Result

Specifications

Specification
CSS Inline Layout Module Level 3
# sizing-drop-initials

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on iOS Samsung Internet WebView Android WebView on iOS
initial-letter
110
110
No
96
9See bug 229090 for the unprefixed property.
110
No
74
9See bug 229090 for the unprefixed property.
Does not support decimal values. See bug 296785.
21.0
110
9See bug 229090 for the unprefixed property.
Does not support decimal values. See bug 296785.
normal
110
110
No
96
9
110
No
74
9
21.0
110
No

See also

  • ::first-letter
  • :first-child
  • Drop caps in CSS via Oddbird (2017)

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/initial-letter

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API