::first-letter
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015ë 7ì.
* Some parts of this feature may have varying levels of support.
::first-letter CSS ìì¬ ììë ë¸ë¡ 컨í
ì´ëì 첫 ë²ì§¸ ì¤ì ìë 첫 ê¸ìì ì¤íì¼ì ì ì©í©ëë¤. ë¨, ê·¸ ìì ë¤ë¥¸ ì½í
ì¸ (ì´ë¯¸ì§ë ì¸ë¼ì¸ í
ì´ë¸)ê° ìë ê²½ì°ìë§ ì ì©ë©ëë¤.
ìëí´ ë³´ê¸°
p::first-letter {
font-size: 1.5rem;
font-weight: bold;
color: brown;
}
<p>
Scientists exploring the depths of Monterey Bay unexpectedly encountered a
rare and unique species of dragonfish. This species is the rarest of its
species.
</p>
<p>
When Robison and a team of researchers discovered this fish, they were aboard
a week-long expedition.
</p>
ììì 첫 ê¸ì를 ìë³íë ì¼ì íì ë¨ìíì§ ììµëë¤.
- 첫 ê¸ì ìë¤ì ì¤ë 구ëì ì 매ì¹ì í¬í¨ë©ëë¤. 구ëì ìë ì ëì½ëìì ì ìë ì¬ë ê´í¸(Ps), ë«ë ê´í¸(Pe), ìì ë°ì´í(Pi), ë ë°ì´í(Pf), 기í 구ëì (Po) í´ëì¤ì í´ë¹íë 문ìê° í¬í¨ë©ëë¤.
- ì¼ë¶ ì¸ì´ìë íì í¨ê» ë문ìë¡ ì°ì´ë ì´ì¤ 문ì(digraph)ê° ììµëë¤. ì를 ë¤ì´ ë¤ëëëì´ì
IJê° ê·¸ë¬í©ëë¤. ì´ë° ê²½ì°::first-letterìì¬ ììë ë ê¸ì를 모ë 매ì¹í´ì¼ í©ëë¤. ::beforeìì¬ ìììcontentìì±ì ì¡°í©í´ ìì ìì í ì¤í¸ë¥¼ ì½ì í ì ììµëë¤. ì´ ê²½ì°::first-letterë ì½ì ë ì½í ì¸ ì 첫 ê¸ì를 매ì¹í©ëë¤.
ì°¸ê³ :
CSSë ìì¬ í´ëì¤ì ìì¬ ìì를 구ë¶í기 ìí´ ::first-letterì ê°ì´ ì½ë¡ ë ê°(::)를 ì¬ì©íë í기ë²ì ëì
íìµëë¤. íì í¸íì±ì ìí´ ë¸ë¼ì°ì ë ì´ì ì ëì
ë ë¨ì¼ ì½ë¡ (:first-letter) í기ë ì§ìí©ëë¤.
ë¤ëëëì´ IJ ê°ì ì´ì¤ 문ìì ëí ë¸ë¼ì°ì ì§ìì 미í¡í©ëë¤. ìë í¸íì± íìì íì¬ ìí를 íì¸íì¸ì.
ì¬ì© ê°ë¥í ìì±
::first-letter ìì¬ ììì í¨ê» ì¬ì©í ì ìë CSS ìì±ì ì¼ë¶ì íì ë©ëë¤.
- 모ë ê¸ê¼´ ê´ë ¨ ìì±:
font,font-style,font-feature-settings,font-kerning,font-language-override,font-stretch,font-synthesis,font-variant,font-variant-alternates,font-variant-caps,font-variant-east-asian,font-variant-ligatures,font-variant-numeric,font-variant-position,font-weight,font-size,font-size-adjust,line-height,font-family - 모ë ë°°ê²½ ìì±:
background,background-color,background-image,background-clip,background-origin,background-position,background-repeat,background-size,background-attachment,background-blend-mode - 모ë ë§ì§ ìì±:
margin,margin-top,margin-right,margin-bottom,margin-left - 모ë í¨ë© ìì±:
padding,padding-top,padding-right,padding-bottom,padding-left - 모ë í
ë리 ìì±:
border,border-style,border-color,border-width,border-radius,border-image colorìì±text-decoration,text-shadow,text-transform,letter-spacing,word-spacing(ì ì í ê²½ì°),line-height,text-decoration-color,text-decoration-line,text-decoration-style,box-shadow,float,vertical-align(floatì´noneì¼ ê²½ì°ë§)
구문
::first-letter {
/* ... */
}
ìì
>기본 ëë¡ ìº¡ (drop cap)
ì´ ìì ììë ::first-letter ìì¬ ìì를 ì¬ì©í´ <h2> ë°ë¡ ë¤ì ì¤ë ë¨ë½ì 첫 ê¸ì를 ëë¡ ìº¡ í¨ê³¼ë¡ 꾸ë°ëë¤.
HTML
<h2>My heading</h2>
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
kasd gubergren, no sea takimata sanctus est.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
consequat.
</p>
CSS
p {
width: 500px;
line-height: 1.5;
}
h2 + p::first-letter {
color: white;
background-color: black;
border-radius: 2px;
box-shadow: 3px 3px 0 red;
font-size: 250%;
padding: 6px 3px;
margin-right: 6px;
float: left;
}
ê²°ê³¼
í¹ì 구ëì ë° ë¹ë¼í´ 문ìì ëí í¨ê³¼
ì´ ìì ë ::first-letterê° í¹ì 구ëì ë° ë¹(é)ë¼í´ 문ìì ì´ë»ê² ì ì©ëëì§ ë³´ì¬ì¤ëë¤.
HTML
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
consequat.
</p>
<p>-The beginning of a special punctuation mark.</p>
<p>_The beginning of a special punctuation mark.</p>
<p>"The beginning of a special punctuation mark.</p>
<p>'The beginning of a special punctuation mark.</p>
<p>*The beginning of a special punctuation mark.</p>
<p>#The beginning of a special punctuation mark.</p>
<p>ãç¹æ®çæ±åæ ç¹ç¬¦å·å¼å¤´ã</p>
<p>ãç¹æ®çæ±åæ ç¹ç¬¦å·å¼å¤´ã</p>
<p>"ç¹æ®çæ±åæ ç¹ç¬¦å·å¼å¤´ã</p>
CSS
p::first-letter {
color: red;
font-size: 150%;
}
ê²°ê³¼
SVG text ìììì 첫 ê¸ì ì¤íì¼ë§
ì´ ìì ììë ::first-letter ìì¬ ìì를 ì¬ì©í´ SVG <text> ììì 첫 ê¸ì를 ì¤íì¼ë§í©ëë¤.
ì°¸ê³ : ìì± ìì 기ì¤ì¼ë¡ ì´ ê¸°ë¥ì ì íì ì¼ë¡ë§ ì§ìë©ëë¤.
HTML
<svg viewBox="0 0 300 40">
<text y="30">First letter in <text> SVG</text>
</svg>
CSS
text {
font-family: sans-serif;
}
text::first-letter {
font-family: serif;
font-size: 2rem;
font-weight: 600;
fill: tomato;
stroke: indigo;
}
ê²°ê³¼
ëª ì¸ì
| Specification |
|---|
| CSS Pseudo-Elements Module Level 4 > # first-letter-pseudo > |