CSS font-size 속성은 글꼴 크기를 설정하는 데 사용됩니다. 백분율, 픽셀, cm, 포인트, em 등과 같은 단위 및 절대 키워드로 값을 지정할 수 있습니다. 상대적 값은 접근성을 최대화합니다. 기본 글꼴 크기는 16px 또는 12pt입니다.
구문
CSS font-size 속성의 구문은 다음과 같습니다 -
Selector {
font-size: /*value*/
} 다음 예는 CSS font-size 속성을 보여줍니다 -
예시
<!DOCTYPE html>
<html>
<head>
<style>
div {
margin: auto;
padding: 10px;
text-align: center;
width: 50%;
border: 2px solid;
border-radius: 15%;
font-size: 1.4em;
}
</style>
</head>
<body>
<div>
one
<div>two
<div>three</div>
</div>
</div>
</body>
</html> 출력
이것은 다음과 같은 출력을 제공합니다 -

예시
<!DOCTYPE html>
<html>
<head>
<style>
p {
font-size: smaller;
}
#demo {
font-size: initial;
}
p:last-of-type {
font-size: 200%;
}
</style>
</head>
<body>
<h2>Demo Heading</h2>
<p>This is demo text 1.</p>
<p id="demo">This is demo text 2. </p>
<p>This is demo text 3.</p>
</body>
</html> 출력
이것은 다음과 같은 출력을 제공합니다 -
