스타일 fontStyle 속성
예시
요소의 글꼴을 "기울임꼴"로 설정합니다.
document.getElementById("demo").style.fontStyle = "italic";
정의 및 사용
fontStyle 속성은 글꼴의 스타일이 normal, italic 또는 oblique인지 여부를 설정하거나 반환합니다.
브라우저 지원
Property | |||||
---|---|---|---|---|---|
fontStyle | Yes | Yes | Yes | Yes | Yes |
통사론
fontStyle 속성을 반환합니다.
object.style.fontStyle
fontStyle 속성을 설정합니다.
object.style.fontStyle = "normal|italic|oblique|initial|inherit"
속성 값
Value | Description |
---|---|
normal | Font is normal. This is default |
italic | Font is in italic |
oblique | Font is in oblique |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
기술적 세부 사항
기본값: | 정상 |
---|---|
반환 값: | 요소에 있는 텍스트의 글꼴 스타일을 나타내는 String |
CSS 버전 | CSS1 |
더 많은 예
예시
가능한 값의 데모:
var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("demo").style.fontStyle = listValue;
예시
요소의 글꼴 스타일을 반환합니다.
alert(document.getElementById("demo").style.fontStyle);
관련 페이지
CSS 튜토리얼: CSS 글꼴
CSS 참조: 글꼴 스타일 속성
HTML DOM 참조: 글꼴 속성
❮ 스타일 개체