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:
@@ -0,0 +1,146 @@
|
||||
---
|
||||
id: css-interactive-pseudo-classes
|
||||
title: "CSS Interactive Pseudo-classes"
|
||||
category: "Frontend"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["interactive pseudo-classes", "link pseudo-classes", "hover focus active", "anchor states", "hover tooltip"]
|
||||
duplicate_of: ""
|
||||
source_trust_level: "B"
|
||||
confidence_score: 0.88
|
||||
created_at: 2026-06-23
|
||||
updated_at: 2026-06-23
|
||||
review_reason: ""
|
||||
merge_history: []
|
||||
tags: ["css", "web", "frontend", "w3schools", "pseudo-classes", "links"]
|
||||
raw_sources: ["https://www.w3schools.com/css/css_pseudo_classes_interactive.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[CSS Interactive Pseudo-classes]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
Interactive pseudo-classes style elements in response to user actions — the four link states (`:link`, `:visited`, `:hover`, `:active`) must be declared in a specific order, and `:hover`/`:focus` also power effects like tooltips and highlighted inputs. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **Four link states** — `:link` (unvisited), `:visited` (visited), `:hover` (mouseover), `:active` (when clicked/activated). [S1]
|
||||
- **Order matters** — `a:hover` MUST come after `a:link` and `a:visited` to be effective; `a:active` MUST come after `a:hover` to be effective. [S1]
|
||||
- **`:hover` is not just for links** — it can apply to any element, e.g. a `<div>`. [S1]
|
||||
- **`:focus`** — styles a form input while it has focus. [S1]
|
||||
- **Hover-driven reveal** — `div:hover p` can show a hidden paragraph, producing a simple tooltip effect. [S1]
|
||||
- **Combine with classes** — pseudo-classes can be combined with HTML classes, e.g. `a.highlight:hover`. [S1]
|
||||
|
||||
## 🧩 추출된 패턴 (Extracted patterns)
|
||||
- **LVHA ordering** — declare link, visited, hover, active in that cascade order so each rule takes effect. [S1]
|
||||
- **Hover-to-reveal** — hide a child (`display: none`) and show it (`display: block`) on parent hover for a tooltip. [S1]
|
||||
- **Scoped hover** — pair a class with `:hover` (`a.highlight:hover`) to limit the effect to selected elements. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
**Link pseudo-classes (the four states)**
|
||||
Style links through different states using `:link`, `:visited`, `:hover`, and `:active`: [S1]
|
||||
```css
|
||||
/* unvisited link */
|
||||
a:link {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
/* visited link */
|
||||
a:visited {
|
||||
color: #00FF00;
|
||||
}
|
||||
|
||||
/* mouse over link */
|
||||
a:hover {
|
||||
color: #FF00FF;
|
||||
}
|
||||
|
||||
/* selected link */
|
||||
a:active {
|
||||
color: #0000FF;
|
||||
}
|
||||
```
|
||||
|
||||
**Ordering note**
|
||||
`a:hover` MUST come after `a:link` and `a:visited` in the CSS definition in order to be effective! `a:active` MUST come after `a:hover` in the CSS definition in order to be effective! [S1]
|
||||
|
||||
**`:hover` on a `div` element** [S1]
|
||||
```css
|
||||
div:hover {
|
||||
background-color: blue;
|
||||
}
|
||||
```
|
||||
|
||||
**Simple tooltip hover effect**
|
||||
Hovering over a `<div>` reveals a hidden paragraph: [S1]
|
||||
```css
|
||||
p {
|
||||
display: none;
|
||||
background-color: yellow;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
div:hover p {
|
||||
display: block;
|
||||
}
|
||||
```
|
||||
|
||||
**`:focus` on an `input` element** [S1]
|
||||
```css
|
||||
input:focus {
|
||||
background-color: yellow;
|
||||
}
|
||||
```
|
||||
|
||||
**Combining pseudo-classes with HTML classes** [S1]
|
||||
```css
|
||||
a.highlight:hover {
|
||||
color: #ff0000;
|
||||
}
|
||||
```
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
The page's own applied examples are: coloring the four anchor link states, changing a `div` background on hover, a hover-reveal tooltip (`div:hover p`), highlighting a focused input, and a class-scoped hover (`a.highlight:hover`). No external project/commit applications found in the source.
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Hover-to-reveal tooltip (language: CSS):
|
||||
```css
|
||||
p {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div:hover p {
|
||||
display: block;
|
||||
}
|
||||
```
|
||||
Class-scoped hover:
|
||||
```css
|
||||
a.highlight:hover {
|
||||
color: #ff0000;
|
||||
}
|
||||
```
|
||||
|
||||
## ⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
|
||||
- **`:hover` vs `:active` vs `:focus`** — `:hover` reacts to the mouse being over an element, `:active` to the element being activated (e.g. clicked), and `:focus` to an element (typically a form field) holding focus. For links, all four states must follow the LVHA order to apply correctly. [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.88
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[CSS Tutorial]]
|
||||
- **관련 개념:** [[CSS Pseudo-classes]], [[CSS Combinators]], [[CSS Links]], [[CSS Selectors]]
|
||||
- **참조 맥락:** Referenced when styling link states, hover/focus interactions, and hover-driven UI such as tooltips.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — CSS Interactive Pseudo-classes — https://www.w3schools.com/css/css_pseudo_classes_interactive.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Interactive Pseudo-classes" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user