Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The initial-letter-align
CSS property specifies the alignment of initial letters within a paragraph.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The initial-letter-align
CSS property specifies the alignment of initial letters within a paragraph.
css
/* Keyword values */
initial-letter-align: auto;
initial-letter-align: alphabetic;
initial-letter-align: hanging;
initial-letter-align: ideographic;
/* Global values */
initial-letter-align: inherit;
initial-letter-align: initial;
initial-letter-align: revert;
initial-letter-align: revert-layer;
initial-letter-align: unset;
One of the keyword values listed below.
auto
The user agent selects the value which corresponds to the language of the text. Western languages would default to alphabetic, CJK languages to ideographic, and some Indic languages to hanging.
alphabetic
As described above, the cap height of the initial letter aligns with the cap height of the first line of text. The baseline of the initial letter aligns with the baseline of the Nth text baseline.
hanging
The hanging baseline of the initial letter aligns with the hanging baseline of the first line of text.
ideographic
The initial letter is centered in the N-line area.
Initial value | auto |
---|---|
Applies to | ::first-letter pseudo-elements and inline-level first child of a block container |
Inherited | no |
Computed value | as specified |
Animation type | discrete |
html
<p class="auto ">Initial letter - auto</p>
<p class="alphabetic">Initial letter - alphabetic</p>
<p class="hanging">Initial letter - hanging</p>
<p class="ideographic">Initial letter - ideographic</p>
css
.auto::first-letter {
-webkit-initial-letter-align: auto;
initial-letter-align: auto;
}
.alphabetic::first-letter {
-webkit-initial-letter-align: alphabetic;
initial-letter-align: alphabetic;
}
.hanging::first-letter {
-webkit-initial-letter-align: hanging;
initial-letter-align: hanging;
}
.ideographic::first-letter {
-webkit-initial-letter-align: ideographic;
initial-letter-align: ideographic;
}
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
initial-letter-align |
No | No | No | No | No | No | No | No | No | No | No | No |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/initial-letter-align