text-shadow
text-shadow
CSS 속성은 텍스트에 그림자(shadow)를 추가합니다. 텍스트와 그 장식에 적용 할 쉼표로 구분 된 그림자 목록을 허용합니다. 각 그림자는 요소, 흐림 반경 및 색상의 X 및 Y 오프셋 조합으로 설명됩니다.
시도해보기
구문
css
/* offset-x | offset-y | blur-radius | color */
text-shadow: 1px 1px 2px black;
/* color | offset-x | offset-y | blur-radius */
text-shadow: #fc0 1px 0 10px;
/* offset-x | offset-y | color */
text-shadow: 5px 5px #558abb;
/* color | offset-x | offset-y */
text-shadow: white 2px 5px;
/* offset-x | offset-y
/* Use defaults for color and blur-radius */
text-shadow: 5px 10px;
/* Global values */
text-shadow: inherit;
text-shadow: initial;
text-shadow: revert;
text-shadow: revert-layer;
text-shadow: unset;
This property is specified as a comma-separated list of shadows.
Each shadow is specified as two or three <length>
values, followed optionally by a <color>
value. The first two <length>
values are the <offset-x>
and <offset-y>
values. The third, optional, <length>
value is the <blur-radius>
. The<color>
value is the shadow's color.
When more than one shadow is given, shadows are applied front-to-back, with the first-specified shadow on top.
This property applies to both ::first-line
(en-US) and ::first-letter
(en-US) pseudo-elements.
Values
<color>
-
Optional. The color of the shadow. It can be specified either before or after the offset values. If unspecified, the color's value is left up to the user agent, so when consistency across browsers is desired you should define it explicitly.
<offset-x> <offset-y>
-
Required. These
<length>
values specify the shadow's distance from the text.<offset-x>
specifies the horizontal distance; a negative value places the shadow to the left of the text.<offset-y>
specifies the vertical distance; a negative value places the shadow above the text. If both values are0
, the shadow is placed directly behind the text, although it may be partly visible due to the effect of<blur-radius>
. <blur-radius>
-
Optional. This is a
<length>
value. The higher the value, the bigger the blur; the shadow becomes wider and lighter. If not specified, it defaults to0
.
Formal definition
초기값 | none |
---|---|
적용대상 | all elements. It also applies to ::first-letter (en-US) and ::first-line (en-US). |
상속 | yes |
계산 값 | a color plus three absolute lengths |
Animation type | a shadow list |
Formal syntax
Examples
Simple shadow
css
.red-text-shadow {
text-shadow: red 0 -2px;
}
html
<p class="red-text-shadow">Sed ut perspiciatis unde omnis iste
natus error sit voluptatem accusantium doloremque laudantium,
totam rem aperiam, eaque ipsa quae ab illo inventore.</p>
Multiple shadows
css
.white-text-with-blue-shadow {
text-shadow: 1px 1px 2px black, 0 0 1em blue, 0 0 0.2em blue;
color: white;
font: 1.5em Georgia, serif;
}
html
<p class="white-text-with-blue-shadow">Sed ut perspiciatis unde omnis iste
natus error sit voluptatem accusantium doloremque laudantium,
totam rem aperiam, eaque ipsa quae ab illo inventore.</p>
명세서
Specification |
---|
CSS Text Decoration Module Level 3 # text-shadow-property |
브라우저 호환성
BCD tables only load in the browser
See also
box-shadow
- The
<color>
data type (for specifying the shadow color) - Applying color to HTML elements using CSS