opacity
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ì.
opacity CSS ìì±ì ììì ë¶í¬ëª
ë를 ì¤ì í©ëë¤. ë¶í¬ëª
ëë ìì ë¤ìª½ ì½í
ì¸ ê° ì¨ê²¨ì§ë ì ëë¡, í¬ëª
ëì ë°ëì
ëë¤.
ìëí´ ë³´ê¸°
opacity: 0;
opacity: 0.33;
opacity: 1;
<section class="default-example" id="default-example">
<p id="example-element">
London. Michaelmas term lately over, and the Lord Chancellor sitting in
Lincoln's Inn Hall. Implacable November weather. As much mud in the streets
as if the waters had but newly retired from the face of the earth, and it
would not be wonderful to meet a Megalosaurus, forty feet long or so,
waddling like an elephantine lizard up Holborn Hill.
</p>
</section>
#example-element {
background-color: #963770;
color: white;
padding: 1em;
}
opacityë ììì ë´ì©ì í¬í¨í´ 모ë ê³³ì ìí¥ì 주ì§ë§ ìì ììê° ììíì§ë ììµëë¤. ë°ë¼ì ììì ììì í¬ëª
ëê° ìë¡ ë¤ë¥´ëë¼ë ë°°ê²½ì ëí´ìë ìëì ì¼ë¡ ê°ì í¬ëª
ë를 ê°ìµëë¤.
opacity ê°ì´ 1ì´ ìëë©´ ìì를 ìë¡ì´ ìì ë§¥ë½ì ë°°ì¹í©ëë¤.
ìì ììë ë¶í¬ëª
íê² ì ì§íê³ ì¶ë¤ë©´ background ìì±ì ëì ì¬ì©íì¸ì.
background: rgba(0, 0, 0, 0.4);
구문
>ê°
<alpha-value>-
ì±ëì ë¶í¬ëª ë(ìí ì±ëì ê°)를 ëíë´ë
0.0ì´ì1.0ì´íì<number>, ëë 0% ì´ì 100% ì´íì<percentage>. ë²ì ë°ì ì«ìë 구문 ì ì í¨íì§ë§, ì¤ì ì ì© ììë ë²ìì ë§ì¶° ëë¨¸ì§ ê°ì ë²ë ¤ì§ëë¤.ê° ë» 0ììê° ìì í í¬ëª í´ ë³´ì´ì§ ìì. 0ê³¼1ì¬ì´ì ì무<number>ììê° ë°í¬ëª í´ ë¤ì ë´ì©ì ë³¼ ì ìì. 1(기본ê°)ììê° ë¶í¬ëª í¨.
íì 구문
opacity =
<opacity-value>
<opacity-value> =
<number> |
<percentage>
ìì
>기본 ìì
div {
background-color: yellow;
}
.light {
opacity: 0.2; /* ë°°ê²½ ìë¡ ê²¨ì° ë³¼ ì ìì */
}
.medium {
opacity: 0.5; /* ë°°ê²½ ìë¡ ì¡°ê¸ ë ì ë³´ì */
}
.heavy {
opacity: 0.9; /* ë°°ê²½ ìë¡ ëë ·íê² ë³´ì */
}
<div class="light">ê²¨ì° ë³´ì´ë ê¸</div>
<div class="medium">ì¢ ë ì ë³´ì´ë ê¸</div>
<div class="heavy">ì½ê² ë³´ì´ë ê¸</div>
:hover ì ë¤ë¥¸ ë¶í¬ëª
ë ì ì©
img.opacity {
opacity: 1;
}
img.opacity:hover {
opacity: 0.5;
filter: alpha(opacity=50);
zoom: 1;
}
<img
src="https://developer.mozilla.org/mdn-social-share.png"
alt="MDN logo"
width="128"
height="146"
class="opacity" />
ì ê·¼ì± ê³ ë ¤ì¬í
ê¸ì¨ì í¬ëª ë를 ì¡°ì íë¤ë©´, ë®ì ìë ¥ì ê°ì§ ì¬ì©ìë íì´ì§ì ì½í ì¸ ë¥¼ ì½ì ì ìëë¡ ê¸ì ìê³¼ ë°°ê²½ìì ëë¹ë¥¼ ëê² ì ì§íë ê²ì´ ì¤ìí©ëë¤.
ì ëë¹ì¨ì ë°°ê²½ìê³¼ í¬ëª ë를 ì ì©í ê¸ì ìì ë°ê¸°ë¥¼ ë¹êµí´ì ì»ì´ë¼ ì ììµëë¤. íì¬ ì¹ ì½í ì¸ ì ê·¼ì± ê°ì´ëë¼ì¸(WCAG)ì ë§ì¡±íë ¤ë©´, í ì¤í¸ ì½í ì¸ ë 4.5:1, ì 목 ë± í° í ì¤í¸ë 3:1ì ëë¹ì¨ì´ íìí©ëë¤. í° í ì¤í¸ë 18.66px ì´ìì êµµì ê¸ì¨ í¹ì 24px ì´ìì í ì¤í¸ë¡ ì ìíê³ ììµëë¤.
ëª ì¸
| Specification |
|---|
| CSS Color Module Level 4 > # propdef-opacity > |
| Scalable Vector Graphics (SVG) 2 > # ObjectAndGroupOpacityProperties > |
| ì´ê¸°ê° | 1 |
|---|---|
| ì ì©ëì | all elements |
| ìì | no |
| Percentages | map to the range [0,1] |
| ê³ì° ê° | The same as the specified value after clipping the <number> to the range [0.0, 1.0]. |
| Animation type | by computed value type |