text-decoration
CSS 단축 속성은 글씨의 장식(선) 색을 지정합니다. text-decoration-line
, text-decoration-color
, text-decoration-style
, text-decoration-thickness
속성 값을 설정합니다.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
글씨 장식은 모든 하위 텍스트 요소에 적용됩니다. 따라서 자식 요소는 부모가 적용한 장식을 제거할 수 없습니다. 예를 들어 <p>이 문단에 <em>강조 표시</em>가 있어요.</p>
마크업에 p { text-decoration: underline; }
스타일을 적용하면 전체 문단에 밑줄이 쳐집니다. em { text-decoration: none; }
을 추가하더라도 아무 변화도 일어나지 않습니다. 다만 em { text-decoration: overline; }
스타일은 "강조 표시"가 윗줄과 밑줄 모두 갖게 합니다.
구문
text-decoration
속성은 한 개 이상의 공백으로 구분한 값으로 지정할 수 있습니다. 각각의 값은 본디 속성에서 사용하는 값입니다.
값
text-decoration-line
underline
,line-through
등 장식의 종류.text-decoration-color
- 장식의 색.
text-decoration-style
solid
,wavy
,dashed
등 장식의 스타일.text-decoration-thickness
- 요소를 꾸미는데 사용되는 선의 두께를 설정합니다.
형식 구문
<'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> || <'text-decoration-thickness'>
예제
.under { text-decoration: underline red; } .over { text-decoration: wavy overline lime; } .line { text-decoration: line-through; } .plain { text-decoration: none; } .underover { text-decoration: dashed underline overline; } .thick { text-decoration: solid underline purple 4px; } .blink { text-decoration: blink; }
<p class="under">밑줄을 가진 글씨입니다.</p> <p class="over">윗줄을 가진 글씨입니다.</p> <p class="line">취소선을 가진 글씨입니다.</p> <p>여기 링크는 기본값과 다르게 <a class="plain" href="#">밑줄이 없습니다</a>. 사용자는 보통 하이퍼링크를 구분할 때 밑줄 여부로 판단하므로 지우기 전에 조심해야 합니다.</p> <p class="underover">밑줄과 윗줄 모두 가진 글씨입니다.</p> <p class="thick">이 글씨는 아주 두꺼운 보라색 밑줄을 표시합니다. (브라우저가 지원하는 경우)</p> <p class="blink">이 글씨는 브라우저에 따라서 깜빡일 수 있어요.</p>
명세
Specification | Status | Comment |
---|---|---|
CSS Text Decoration Module Level 4 | Working Draft | Adds text-decoration-thickness ; note that this isn't yet officially part of the shorthand — this is as yet unspecified. |
CSS Text Decoration Module Level 3 The definition of 'text-decoration' in that specification. |
Candidate Recommendation | Transformed into a shorthand property. Added support for the value of text-decoration-style . |
CSS Level 2 (Revision 1) The definition of 'text-decoration' in that specification. |
Recommendation | No significant changes. |
CSS Level 1 The definition of 'text-decoration' in that specification. |
Recommendation | Initial definition. |
초기값 | as each of the properties of the shorthand:
|
---|---|
적용대상 | all elements. It also applies to ::first-letter and ::first-line . |
상속 | no |
Media | visual |
Computed value | as each of the properties of the shorthand:
|
Animation type | as each of the properties of the shorthand:
|
Canonical order | order of appearance in the formal grammar of the values |
브라우저 호환성
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
text-decoration | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 3 | Opera Full support 3.5 | Safari Full support 1 | WebView Android Full support ≤37 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support 1 | Samsung Internet Android Full support Yes |
blink | Chrome No support No | Edge No support No | Firefox No support 1 — 23 | IE No support No | Opera No support 4 — 15 | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android No support 4 — 23 | Opera Android No support 10.1 — 14 | Safari iOS No support No | Samsung Internet Android Full support 7.0 |
Shorthand | Chrome Full support 57 | Edge No support No | Firefox
Full support
36
| IE No support No | Opera Full support 44 | Safari
Full support
8
| WebView Android Full support 57 | Chrome Android Full support 57 | Firefox Android
Full support
36
| Opera Android Full support 43 | Safari iOS
Full support
8
| Samsung Internet Android Full support Yes |
text-decoration-thickness included in shorthand | Chrome No support No | Edge No support No | Firefox Full support 70 | IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android No support No | Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
Legend
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.
- Experimental. Expect behavior to change in the future.
- Non-standard. Expect poor cross-browser support.
- Non-standard. Expect poor cross-browser support.
- Deprecated. Not for use in new websites.
- Deprecated. Not for use in new websites.
- Requires a vendor prefix or different name for use.
- Requires a vendor prefix or different name for use.
같이 보기
- The individual text-decoration properties are
text-decoration-line
,text-decoration-color
, andtext-decoration-style
. - The
list-style
attribute controls the appearance of items in HTML<ol>
and<ul>
lists.