docs(10_Wiki): Dev 폴더 누락분 반영 — Topic_Programming으로 통합

이전 재구성 작업에서 Dev/ 폴더가 누락되었던 것을 반영.

- Dev/Topic_Programming(중첩 폴더, 78개)은 Dev 자체 최상위 폴더들
  (Architecture/Conventions/Engineering_Intelligence 등)과 완전 중복이라 제거.
- Dev 최상위 엔지니어링 지식 폴더(Architecture/Conventions/Engineering_Intelligence/
  Failure_Library/Generalized_Principles/Language/Pattern_Catalog/Platform_Guides/
  Subsystems, 77개)는 이미 Topic_Programming/Topic_Programming에 더 최신 버전이
  존재해 중복 제거(고유 콘텐츠 1개는 예외 처리하여 이동 보존).
- Dev의 W3Schools 언어 튜토리얼 폴더(Topic_C/CPP/CSS/CSharp/HOWTO/HTML/Java/
  JavaScript/PHP/Python/SQL/W3CSS, 1201개)는 전부 Topic_Programming 하위로 이동.
- 에이전트 운영 상태(.astra/docs)는 그대로 유지, 콘텐츠 폴더만 정리.
- Topic_Programming 최종 문서 수: 2784 → 3985.
This commit is contained in:
Antigravity Agent
2026-07-05 00:39:13 +09:00
parent 9148c358d0
commit e9cbf23ab5
1356 changed files with 0 additions and 12831 deletions
@@ -0,0 +1,155 @@
---
id: css-variables-var
title: "CSS Variables var()"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["CSS variables", "var() function", "custom properties", "CSS custom properties", "root variables", "--variable"]
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", "variables", "custom-properties", "var"]
raw_sources: ["https://www.w3schools.com/css/css3_variables.asp"]
applied_in: []
github_commit: ""
---
# [[CSS Variables var()]]
## 🎯 한 줄 통찰 (One-line insight)
CSS variables (custom properties) are declared with a `--name` and read back with `var(--name)`; declaring them once in `:root` gives document-wide reusable values that make stylesheets easier to maintain and update. [S1]
## 🧠 핵심 개념 (Core concepts)
- **Global vs local** — global variables are declared in the `:root` selector for document-wide access; local variables are declared within a specific selector for limited scope. [S1]
- **Naming rules** — variable names must begin with two dashes (`--`) and are case-sensitive. [S1]
- **The var() function** — the syntax is `var(--name, value)`, where the name is required and `value` is an optional fallback. [S1]
- **Why use them** — the main advantages are easier maintenance, improved readability, and simplified color updates across an entire page. [S1]
## 🧩 추출된 패턴 (Extracted patterns)
- **Theme tokens in :root** — declaring colors as `:root` variables creates a single place to change a whole page's palette. [S1]
- **Reuse via var()** — the same `var(--primary-bg-color)` reference reused across selectors keeps related values in sync. [S1]
- **Fallback safety** — `var(--name, value)` supplies a default when the named variable is not defined. [S1]
## 📖 세부 내용 (Details)
**Declaring variables** [S1]
Global variables are declared in the `:root` selector; local variables within a specific selector. Names start with `--` and are case-sensitive:
```css
:root {
--primary-bg-color: green;
}
.note {
--note-bg: yellow;
}
```
**The var() Function** [S1]
The `var()` function is used to insert the value of a CSS variable. Its syntax is `var(--name, value)``--name` is the required variable name, and `value` is an optional fallback used if the variable is not found.
**Example — global variables used across selectors** [S1]
```css
:root {
--primary-bg-color: #1e90ff;
--primary-color: #ffffff;
}
body {
background-color: var(--primary-bg-color);
}
.container {
color: var(--primary-bg-color);
background-color: var(--primary-color);
padding: 15px;
}
.container h2 {
border-bottom: 2px solid var(--primary-bg-color);
}
.container .note {
border: 1px solid var(--primary-bg-color);
padding: 10px;
}
```
**Example — swapping the color scheme by changing only the variables** [S1]
```css
:root {
--primary-bg-color: #8FBC8F;
--primary-color: #FFFAF0;
}
body {
background-color: var(--primary-bg-color);
}
.container {
color: var(--primary-bg-color);
background-color: var(--primary-color);
padding: 15px;
}
.container h2 {
border-bottom: 2px solid var(--primary-bg-color);
}
.container .note {
border: 1px solid var(--primary-bg-color);
padding: 10px;
}
```
**Benefits** [S1]
The page highlights three main advantages of CSS variables: easier maintenance, improved readability, and simplified color updates across entire pages.
## 🛠️ 적용 사례 (Applied in summary)
The page's examples are the applied cases: a `:root` palette referenced by `body`, `.container`, `.container h2`, and `.container .note`, and a second version showing how changing only the `:root` values re-themes the entire layout. No external project/commit applications found in the source.
## 💻 코드 패턴 (Code patterns)
Declare and use a global variable (language: CSS):
```css
:root {
--primary-bg-color: #1e90ff;
}
body {
background-color: var(--primary-bg-color);
}
```
var() with fallback (language: CSS):
```css
.example {
color: var(--name, value);
}
```
## ⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
- **Global (`:root`) variables** — accessible through the entire document; use for site-wide theme tokens such as the primary palette. [S1]
- **Local variables** — declared inside a specific selector and usable only within it; use when a value should only apply to one section. [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.89
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[CSS Tutorial]]
- **관련 개념:** [[CSS Overriding Variables]], [[CSS Colors]], [[CSS Selectors]], [[CSS Syntax]]
- **참조 맥락:** Referenced when centralizing reusable values (colors, sizes) for maintainable, themeable stylesheets.
## 📚 출처 (Sources)
- [S1] W3Schools — CSS Variables var() — https://www.w3schools.com/css/css3_variables.asp
## 📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Variables var()" page (Astra wiki-curation, P-Reinforce v3.1 format).