스타일 fontWeight 속성
예시
요소의 글꼴 두께를 "900"으로 설정합니다.
document.getElementById("demo").style.fontWeight = "900";
정의 및 사용
fontWeight 속성은 텍스트의 굵거나 가는 문자가 표시되어야 하는 정도를 설정하거나 반환합니다.
브라우저 지원
Property | |||||
---|---|---|---|---|---|
fontWeight | Yes | Yes | Yes | Yes | Yes |
통사론
fontWeight 속성을 반환합니다.
object.style.fontWeight
fontWeight 속성을 설정합니다.
object.style.fontWeight = "normal|lighter|bold|bolder|value|initial|inherit"
속성 값
Value | Description |
---|---|
normal | Font is normal. This is default |
lighter | Font is lighter |
bold | Font is bold |
bolder | Font is bolder |
100 200 300 400 500 600 700 800 900 |
Defines from light to bold characters. 400 is the same as normal, and 700 is the same as bold |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
기술적 세부 사항
기본값: | 정상 |
---|---|
반환 값: | 글꼴의 굵기를 나타내는 문자열 |
CSS 버전 | CSS1 |
더 많은 예
예시
가능한 값의 데모:
var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("demo").style.fontWeight = listValue;
예시
요소의 글꼴 두께를 반환합니다.
alert(document.getElementById("demo").style.fontWeight);
관련 페이지
CSS 튜토리얼: CSS 글꼴
CSS 참조: font-weight 속성
HTML DOM 참조: 글꼴 속성
❮ 스타일 개체