docs(10_Wiki): W3Schools 위키화 — HTML/CSS/JavaScript(core)

W3Schools 튜토리얼을 P-Reinforce v3.1 포맷으로 위키화(영어 본문, 한/영 섹션 헤더).
- Topic_HTML: 59문서 (튜토리얼+예제, 레퍼런스/메타 제외)
- Topic_CSS: 190문서 (메인 + Advanced/Flexbox/Grid/RWD 전체)
- Topic_JavaScript: 120문서 (코어 언어; Temporal/DOM상세/BOM/WebAPI/AJAX/jQuery/Graphics 등은 후속)
각 폴더 00_INDEX.md(MOC) 포함. 코드 verbatim, 미확인분은 "Not found in source" 표기.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-23 19:21:18 +09:00
parent 8957890d13
commit 9609c04755
379 changed files with 54618 additions and 6 deletions
+124
View File
@@ -0,0 +1,124 @@
---
id: css-counters
title: "CSS Counters"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["CSS counters", "counter-reset", "counter-increment", "automatic numbering", "counter() function"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.89
created_at: 2026-06-23
updated_at: 2026-06-23
review_reason: ""
merge_history: []
tags: ["css", "web", "frontend", "w3schools", "counters", "generated-content"]
raw_sources: ["https://www.w3schools.com/css/css_counters.asp"]
applied_in: []
github_commit: ""
---
# [[CSS Counters]]
## 🎯 한 줄 통찰 (One-line insight)
CSS counters are "variables" maintained by CSS whose values can be incremented (or decremented) by CSS rules, enabling automatic numbering of elements like section headings — no JavaScript required. [S1]
## 🧠 핵심 개념 (Core concepts)
- **What counters are** — CSS counters are "variables" maintained by CSS, and their values can be incremented (or decremented) by CSS rules. [S1]
- **`counter-reset`** — creates or resets a counter. [S1]
- **`counter-increment`** — increments (or decrements) a counter value. [S1]
- **`content`** — inserts generated content (used with `::before`/`::after`). [S1]
- **`counter()`** — adds/returns the value of a named counter to an element. [S1]
- **Increment direction & amount** — `counter-increment` takes a second parameter (default 1); a negative value decrements, and any value can be used to step by more than 1. [S1]
## 🧩 추출된 패턴 (Extracted patterns)
- **Reset on container, increment on item** — set `counter-reset` on a container (e.g., `body`) and `counter-increment` on the repeated element's `::before`. [S1]
- **Compose generated labels** — combine string literals with `counter(name)` inside `content` to produce labels like `"Section 1: "`. [S1]
- **Tune the step** — change numbering direction/granularity purely by the second argument of `counter-increment` (e.g., `-1`, `2`). [S1]
## 📖 세부 내용 (Details)
**CSS Automatic Numbering With Counters**
CSS counters are "variables" maintained by CSS, and their values can be incremented (or decremented) by CSS rules. The properties/functions used are: `counter-reset` (creates or resets a counter), `counter-increment` (increments/decrements a counter value), `content` (inserts generated content), and `counter()` (adds the value of a counter to an element). [S1]
**CSS Increase and Decrease Counter**
The following example creates a counter for the page (in the `body` selector), then increments the counter value by 1 for each `<h2>` element, adding `"Section <value>: "` before each `<h2>`: [S1]
```css
body {
counter-reset: section;
}
h2::before {
counter-increment: section;
content: "Section " counter(section) ": ";
}
```
**Decrementing a Counter**
The `counter-increment` property has a second parameter. The default value is 1. To decrease the counter value, you can set it to -1: [S1]
```css
body {
counter-reset: section;
}
h2::before {
counter-increment: section -1;
content: "Section " counter(section) ": ";
}
```
**Incrementing by Custom Values**
You can increment the counter by any value. Here we increment by 2: [S1]
```css
body {
counter-reset: section;
}
h2::before {
counter-increment: section 2;
content: "Section " counter(section) ": ";
}
```
## 🛠️ 적용 사례 (Applied in summary)
The page's examples are the applied cases: numbering `<h2>` headings as "Section 1:", "Section 2:", etc., plus variants that decrement (`-1`) and step by 2. No external project/commit applications found in the source.
## 💻 코드 패턴 (Code patterns)
Basic auto-numbering (language: CSS):
```css
body {
counter-reset: section;
}
h2::before {
counter-increment: section;
content: "Section " counter(section) ": ";
}
```
Custom step (language: CSS):
```css
h2::before {
counter-increment: section 2;
}
```
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
No contradictions found in the source.
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.89
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[CSS Tutorial]]
- **관련 개념:** [[CSS Nested Counters]], [[CSS Pseudo-elements]], [[CSS Lists]]
- **참조 맥락:** Referenced when generating automatic numbering for headings, lists, or sections without scripting.
## 📚 출처 (Sources)
- [S1] W3Schools — CSS Counters — https://www.w3schools.com/css/css_counters.asp
## 📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Counters" page (Astra wiki-curation, P-Reinforce v3.1 format).