CSS 글꼴 속성
예시
약식 선언으로 일부 글꼴 속성을 설정합니다.
p.a
{
font: 15px Arial, sans-serif;
}
p.b
{
font: italic small-caps bold 12px/30px Georgia, serif;
}
아래에서 더 많은 "직접 사용해 보기" 예를 살펴보세요.
정의 및 사용
속성은 다음 font
에 대한 약식 속성입니다.
font-size 및 font-family 값은 필수 항목입니다. 다른 값 중 하나가 누락된 경우 해당 기본값이 사용됩니다.
참고: line-height 속성은 줄 사이의 간격을 설정합니다.
기본값: | 글꼴 속성의 기본값 |
---|---|
상속: | 네 |
애니메이션 가능: | 예, 개별 속성을 참조하십시오 . 애니메이션 가능 에 대해 읽기 |
버전: | CSS1 |
자바스크립트 구문: | object .style.font="이탤릭체 작은 대문자 볼드체 12px arial,sans-serif" |
브라우저 지원
표의 숫자는 속성을 완전히 지원하는 첫 번째 브라우저 버전을 지정합니다.
Property | |||||
---|---|---|---|---|---|
font | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
참고: 아래의 각 값에 대한 개별 브라우저 지원을 참조하십시오.
CSS 구문
font: font-style font-variant font-weight font-size/line-height font-family|caption|icon|menu|message-box|small-caption|status-bar|initial|inherit;
속성 값
Property/Value | Description |
---|---|
font-style | Specifies the font style. Default value is "normal" |
font-variant | Specifies the font variant. Default value is "normal" |
font-weight | Specifies the font weight. Default value is "normal" |
font-size/line-height | Specifies the font size and the line-height. Default value is "normal" |
font-family | Specifies the font family. Default value depends on the browser |
caption | Uses the font that are used by captioned controls (like buttons, drop-downs, etc.) |
icon | Uses the font that are used by icon labels |
menu | Uses the fonts that are used by dropdown menus |
message-box | Uses the fonts that are used by dialog boxes |
small-caption | A smaller version of the caption font |
status-bar | Uses the fonts that are used by the status bar |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
더 많은 예
예시
일부 다른 글꼴 속성 값의 데모입니다.
<p style="font:caption">The browser font used in captioned controls.</p>
<p style="font:icon">The browser font used in icon labels.</p>
<p style="font:menu">The browser font used in dropdown menus.</p>
<p style="font:message-box">The browser font used in dialog boxes.</p>
<p style="font:small-caption">A smaller version of the caption font.</p>
<p style="font:status-bar">The browser font used in the status bar.</p>
관련 페이지
CSS 튜토리얼: CSS 글꼴
HTML DOM 참조: 글꼴 속성