---
id: css-font-size
title: "CSS Font Size"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["font-size", "CSS font size", "px em rem", "viewport font size", "responsive text size"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.87
created_at: 2026-06-23
updated_at: 2026-06-23
review_reason: ""
merge_history: []
tags: ["css", "web", "frontend", "w3schools", "fonts", "typography"]
raw_sources: ["https://www.w3schools.com/css/css_font_size.asp"]
applied_in: []
github_commit: ""
---

# [[CSS Font Size]]

## 🎯 한 줄 통찰 (One-line insight)
The `font-size` property sets text size using absolute units (px, keywords) or relative units (em, rem, %, vw); use px for fixed control, em/rem for scalable accessible designs, and rem for consistency since it always refers to the root `<html>` font size. [S1]

## 🧠 핵심 개념 (Core concepts)
- **`font-size` property** — used to specify the size of the text/font; the page emphasizes proper semantic HTML usage for headings and paragraphs. [S1]
- **Absolute sizes** — `px` (pixels) for fixed, precise control, plus keyword sizes: `xx-small`, `x-small`, `small`, `medium`, `large`, `x-large`, `xx-large`. [S1]
- **Relative sizes** — `em` (relative to the parent element's font size), `rem` (relative to the root `<html>` element's font size), `%` (relative to the parent), and `smaller`/`larger` (relative to the parent). [S1]
- **`rem` consistency** — `rem` always refers to the font-size of the `<html>` element, regardless of its position in the document tree, making it superior to `em` for consistency. [S1]

## 🧩 추출된 패턴 (Extracted patterns)
- **Pixel scale** — fixed sizing per element (e.g. h1 40px, h2 30px, p 16px). [S1]
- **Multiplier base** — set a base size on `body`/`html` (16px) and express element sizes as em/rem multipliers (2.5em ≈ 40px, 1.875em ≈ 30px, 1em ≈ 16px). [S1]
- **Viewport scaling** — use `vw` so text scales with the browser window size. [S1]

## 📖 세부 내용 (Details)
The CSS `font-size` property is used to specify the size of the text/font, emphasizing proper semantic HTML usage for headings and paragraphs. [S1]

**Unit types** [S1]
- **Absolute sizes:** `px` (pixels) offer fixed, precise control; keyword sizes are `xx-small`, `x-small`, `small`, `medium`, `large`, `x-large`, `xx-large`.
- **Relative sizes:** `em` (relative to parent's font size), `rem` (relative to root `<html>` font size), `%` (relative to parent), and `smaller`/`larger` (adjust relative to parent).

**Selection guidance** — use `px` for fixed control (though not ideal for responsive design); employ `em` or `rem` for scalable, accessible designs; apply `%` for parent-based adjustments. [S1]

**Pixels approach** — h1 at 40px, h2 at 30px, p at 16px. [S1]
```css
h1 {
  font-size: 40px;
}

h2 {
  font-size: 30px;
}

p {
  font-size: 16px;
}
```

**Em approach** — body base 16px; h1 at 2.5em (40px); h2 at 1.875em (30px); p at 1em (16px). [S1]
```css
body {
  font-size: 16px;
}

h1 {
  font-size: 2.5em;
}

h2 {
  font-size: 1.875em;
}

p {
  font-size: 1em;
}
```

**Rem approach** — html set to 16px; same multipliers as the em approach. [S1]
```css
html {
  font-size: 16px;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 1.875rem;
}

p {
  font-size: 1rem;
}
```

**Viewport width (vw)** — h1 at 10vw; p at 5vw, scaling with browser window resizing. [S1]
```css
h1 {
  font-size: 10vw;
}

p {
  font-size: 5vw;
}
```

**Key concept:** `rem` always refers to the font-size of the `<html>` element, regardless of its position in the document tree, making it superior to `em` for consistency. [S1]

## 🛠️ 적용 사례 (Applied in summary)
The page's examples apply font-size with four unit strategies (px, em, rem, vw) to headings and paragraphs, demonstrating fixed vs. relative vs. viewport-based sizing. No external project/commit applications found in the source.

## 💻 코드 패턴 (Code patterns)
Multiplier base pattern (language: CSS):
```css
html {
  font-size: 16px;
}

h1 {
  font-size: 2.5rem;
}
```
Viewport scaling pattern:
```css
h1 {
  font-size: 10vw;
}
```

## ⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
- **px** — fixed, precise control; not ideal for responsive design. [S1]
- **em** — relative to the parent's font size; can compound through nesting. [S1]
- **rem** — relative to the root `<html>` font size; preferred for consistency because it ignores position in the document tree. [S1]
- **%** — relative to the parent; good for parent-based adjustments. [S1]
- **vw** — scales with browser window size for fluid/responsive text. [S1]

Guidance: use px for fixed control, em or rem for scalable accessible designs, and % for parent-based adjustments. [S1]

## ⚖️ 모순 및 업데이트 (Contradictions & updates)
No contradictions found in the source.

## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.87
- **중복 검사 결과:** 신규 생성 (New discovery)

## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[CSS Tutorial]]
- **관련 개념:** [[CSS Font Family]], [[CSS Font Style]], [[CSS Units]]
- **참조 맥락:** Referenced whenever setting readable, accessible, or responsive text sizing.

## 📚 출처 (Sources)
- [S1] W3Schools — CSS Font Size — https://www.w3schools.com/css/css_font_size.asp

## 📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Font Size" page (Astra wiki-curation, P-Reinforce v3.1 format).
