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>
6.3 KiB
id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
| id | title | category | status | verification_status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | created_at | updated_at | review_reason | merge_history | tags | raw_sources | applied_in | github_commit | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| css-property | CSS @property | Frontend | draft | conceptual |
|
B | 0.87 | 2026-06-23 | 2026-06-23 |
|
|
CSS @property
🎯 한 줄 통찰 (One-line insight)
@property defines custom CSS properties (CSS variables) directly in the stylesheet — without JavaScript — adding data-type checking, a required default value, and explicit control over inheritance. [S1]
🧠 핵심 개념 (Core concepts)
- What it is —
@propertyis used to define custom CSS properties (CSS variables) directly in the stylesheet without having to run any JavaScript. [S1] - Data type checking — ensures custom properties are used correctly via a declared
syntax(e.g."<color>"). [S1] - Default value requirement —
initial-valueprovides a fallback if an invalid value is assigned. [S1] - Inheritance control —
inherits: true | falsegives full control over whether the value inherits. [S1] - Consumed with
var()— once defined, the property is used like any custom property, e.g.background-color: var(--myColor);. [S1]
🧩 추출된 패턴 (Extracted patterns)
- Typed declaration pattern —
@property --name { syntax: "<type>"; inherits: <bool>; initial-value: <value>; }. [S1] - Invalid-value fallback — when a value violates the declared
syntax(e.g. assigning2where a<color>is expected), the property falls back to itsinitial-valueinstead of breaking. [S1] - Animatable custom colors — declaring color custom properties with
@propertyenables them to participate in transitions/animations (e.g. a gradient that animates between--startColorand--endColor). [S1]
📖 세부 내용 (Details)
@property is used to define custom CSS properties (CSS variables) directly in the stylesheet without having to run any JavaScript, with data type checking, default values, and inheritance control. [S1]
Basic syntax [S1]
@property --myColor {
syntax: "<color>";
inherits: true;
initial-value: lightgray;
}
Usage with the var() function: [S1]
body {
background-color: var(--myColor);
}
Example 1 — two custom properties [S1]
@property --my-bg-color {
syntax: "<color>";
inherits: true;
initial-value: lightgray;
}
@property --my-txt-color {
syntax: "<color>";
inherits: true;
initial-value: darkblue;
}
div {
width: 300px;
height: 150px;
padding: 15px;
background-color: var(--my-bg-color);
color: var(--my-txt-color);
}
Example 2 — overriding custom properties per class [S1]
@property --my-bg-color {
syntax: "<color>";
inherits: true;
initial-value: lightgray;
}
div {
width: 300px;
height: 150px;
padding: 15px;
background-color: var(--my-bg-color);
}
.fresh {
--my-bg-color: #ff6347;
}
.nature {
--my-bg-color: rgb(120, 180, 30);
}
Example 3 — type checking with an invalid value [S1]
Here .nature assigns 2, which is not a valid <color>, so the property falls back to its initial-value: [S1]
@property --my-bg-color {
syntax: "<color>";
inherits: true;
initial-value: lightgray;
}
div {
width: 300px;
height: 150px;
padding: 15px;
background-color: var(--my-bg-color);
}
.fresh {
--my-bg-color: #ff6347;
}
.nature {
--my-bg-color: 2;
}
Example 4 — inherits: false [S1]
@property --my-bg-color {
syntax: "<color>";
inherits: false;
initial-value: lightgray;
}
Example 5 — inherits: true [S1]
@property --my-bg-color {
syntax: "<color>";
inherits: true;
initial-value: lightgray;
}
Example 6 — animated gradient colors [S1]
@property --startColor {
syntax: "<color>";
initial-value: #EADEDB;
inherits: false;
}
@property --endColor {
syntax: "<color>";
initial-value: #BC70A4;
inherits: false;
}
Key benefits listed by the source [S1]
- Data type checking ensures custom properties are used correctly.
- Default value requirement provides a fallback if invalid values are assigned.
- Inheritance control gives full control over value inheritance behavior.
🛠️ 적용 사례 (Applied in summary)
The page's applied examples progress from declaring typed color properties (Example 1), overriding them per class .fresh / .nature (Example 2), demonstrating fallback to initial-value on an invalid 2 (Example 3), contrasting inherits: false vs inherits: true (Examples 4–5), and finally declaring --startColor/--endColor for an animated gradient (Example 6). No external project/commit applications found in the source.
💻 코드 패턴 (Code patterns)
Define a typed custom property (language: CSS):
@property --my-bg-color {
syntax: "<color>";
inherits: true;
initial-value: lightgray;
}
Consume it (language: CSS):
div {
background-color: var(--my-bg-color);
}
⚖️ 모순 및 업데이트 (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 Variables, CSS Variables and JavaScript, CSS Variables in Media Queries, CSS var Function
- 참조 맥락: Referenced when custom properties need type safety, guaranteed fallbacks, or animation support without JavaScript.
📚 출처 (Sources)
- [S1] W3Schools — CSS @property — https://www.w3schools.com/css/css3_property.asp
📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS @property" page (Astra wiki-curation, P-Reinforce v3.1 format).