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,143 @@
|
||||
---
|
||||
id: css-tooltips
|
||||
title: "CSS Tooltips"
|
||||
category: "Frontend"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["tooltip", "CSS tooltip", "hover tooltip", "tooltiptext", "hover hint", "info tooltip"]
|
||||
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", "tooltip", "hover"]
|
||||
raw_sources: ["https://www.w3schools.com/css/css_tooltip.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[CSS Tooltips]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
A CSS tooltip shows extra information about an element when the user moves the mouse pointer over it, built from a hidden, absolutely-positioned text box that is revealed on `:hover`. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **Purpose** — a tooltip specifies extra information about something when the user hovers the mouse pointer over an element. [S1]
|
||||
- **Two-element structure** — a container element (class `tooltip`) wraps the trigger text and a nested element (class `tooltiptext`) that holds the tooltip text. [S1]
|
||||
- **Hidden by default** — the tooltip text starts with `visibility: hidden` and becomes `visible` only on hover of the container. [S1]
|
||||
- **Positioning context** — the container is `position: relative` so the absolutely-positioned tooltip text is placed relative to it. [S1]
|
||||
- **Stacking** — `z-index: 1` keeps the tooltip above other content. [S1]
|
||||
|
||||
## 🧩 추출된 패턴 (Extracted patterns)
|
||||
- **Hover-reveal pattern** — hide an element, then flip it to visible via a descendant selector triggered by the parent's `:hover` state (`.tooltip:hover .tooltiptext`). [S1]
|
||||
- **Directional placement** — the same tooltip text box can be moved right, left, above, or below the trigger by switching which offset properties (`left`/`right`/`top`/`bottom`) and centering margins are set. [S1]
|
||||
- **Fade-in via opacity transition** — instead of toggling visibility instantly, animate `opacity` from 0 to 1 with a `transition` for a smooth appearance. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
**What is a CSS tooltip?**
|
||||
A CSS tooltip is used to specify extra information about something when the user moves the mouse pointer over an element. [S1]
|
||||
|
||||
**Basic tooltip**
|
||||
The container uses `position: relative` and `display: inline-block`; the tooltip text is hidden and absolutely positioned, and a hover rule on the container makes it visible. [S1]
|
||||
```css
|
||||
.tooltip {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
border-bottom: 1px dotted black;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tooltiptext {
|
||||
visibility: hidden;
|
||||
width: 130px;
|
||||
background-color: black;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
padding: 5px 0;
|
||||
border-radius: 6px;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.tooltip:hover .tooltiptext {
|
||||
visibility: visible;
|
||||
}
|
||||
```
|
||||
|
||||
**Positioning the tooltip**
|
||||
By adding offset properties to the `.tooltiptext` rule, the tooltip is moved to the right, left, top, or bottom of the trigger. The grounded offset values from the source are: [S1]
|
||||
|
||||
| Direction | Offset properties |
|
||||
|-----------|-------------------|
|
||||
| Right | `left: 105%; top: -5px;` |
|
||||
| Left | `right: 105%; top: -5px;` |
|
||||
| Top | `bottom: 100%; left: 50%; margin-left: -65px;` |
|
||||
| Bottom | `top: 100%; left: 50%; margin-left: -65px;` |
|
||||
|
||||
For the top and bottom variants, `left: 50%` plus a negative `margin-left` of half the tooltip width (`-65px` for a `130px`-wide box) horizontally centers the tooltip over the trigger. [S1]
|
||||
|
||||
**Fade-in animation**
|
||||
To fade the tooltip in instead of showing it instantly, start the text at `opacity: 0`, add a `transition` on opacity, and raise it to `1` on hover. This creates a 2-second fade from invisible to fully visible. [S1]
|
||||
```css
|
||||
.tooltiptext {
|
||||
opacity: 0;
|
||||
transition: opacity 2s;
|
||||
}
|
||||
|
||||
.tooltip:hover .tooltiptext {
|
||||
opacity: 1;
|
||||
}
|
||||
```
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
The tutorial's own example — a `.tooltip` container with a nested `.tooltiptext` element revealed on hover — is the canonical applied case. No external project/commit applications found in the source.
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Hover-reveal tooltip skeleton (language: CSS):
|
||||
```css
|
||||
.tooltip {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.tooltip .tooltiptext {
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.tooltip:hover .tooltiptext {
|
||||
visibility: visible;
|
||||
}
|
||||
```
|
||||
Directional placement (right of the trigger):
|
||||
```css
|
||||
.tooltip .tooltiptext {
|
||||
top: -5px;
|
||||
left: 105%;
|
||||
}
|
||||
```
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (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 Tooltip Arrows]], [[CSS Position]], [[CSS Visibility]], [[CSS Transitions]]
|
||||
- **참조 맥락:** Referenced whenever a hover hint or extra-information popup is needed on a UI element.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — CSS Tooltips — https://www.w3schools.com/css/css_tooltip.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Tooltips" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user