스타일 fontSize 속성
예시
요소의 글꼴 크기를 "x-large"로 설정합니다.
document.getElementById("demo").style.fontSize = "x-large";
정의 및 사용
fontSize 속성은 텍스트의 글꼴 크기를 설정하거나 반환합니다.
브라우저 지원
Property | |||||
---|---|---|---|---|---|
fontSize | Yes | Yes | Yes | Yes | Yes |
통사론
fontSize 속성을 반환합니다.
object.style.fontSize
fontSize 속성을 설정합니다.
object.style.fontSize = "value|initial|inherit"
속성 값
Value | Description |
---|---|
xx-small x-small small medium large x-large xx-large |
Sets the size of the font to different fixed sizes, from xx-small to xx-large |
smaller | Decreases the font-size by one relative unit |
larger | Increases the font-size by one relative unit |
length | Defines the font-size in length units |
% | Sets the font-size to a % of the parent element's font size |
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.fontSize = listValue;
예시
요소의 글꼴 크기를 반환합니다.
alert(document.getElementById("demo").style.fontSize);
관련 페이지
CSS 튜토리얼: CSS 글꼴
CSS 참조: 글꼴 크기 속성
HTML DOM 참조: 글꼴 속성
❮ 스타일 개체