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,138 @@
|
||||
---
|
||||
id: css-tooltip-arrows
|
||||
title: "CSS Tooltip Arrows"
|
||||
category: "Frontend"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["tooltip arrow", "tooltip pointer", "speech bubble tooltip", "tooltip caret", "arrow 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", "tooltip", "pseudo-element"]
|
||||
raw_sources: ["https://www.w3schools.com/css/css_tooltip_arrows.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[CSS Tooltip Arrows]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
A tooltip arrow is drawn with the `::after` pseudo-element using the border trick — one border side is colored and the others are transparent — giving the tooltip a "speech bubble" look. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **Pseudo-element arrow** — the arrow is created with the `::after` pseudo-element and a `content` property. [S1]
|
||||
- **Border trick** — setting one side of the border to a color while the other three sides are `transparent` produces a triangular arrow. [S1]
|
||||
- **Positioning** — the arrow is absolutely positioned relative to the tooltip; `top: 100%` places it at the bottom of the tooltip and `left: 50%` centers it horizontally. [S1]
|
||||
- **Size and centering** — `border-width` controls the arrow size, and a `margin` of half that width (e.g. `margin-left: -5px` for `border-width: 5px`) keeps it centered. [S1]
|
||||
|
||||
## 🧩 추출된 패턴 (Extracted patterns)
|
||||
- **Four-direction arrow pattern** — the arrow points down, up, right, or left depending on which border side is colored and where the pseudo-element is anchored (`top`/`bottom` vs `left`/`right` at 100%). [S1]
|
||||
- **Color-on-one-side rule** — `border-color` takes four values (top right bottom left); coloring exactly one and leaving the rest transparent yields a single triangle. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
**How tooltip arrows work**
|
||||
To create an arrow that appears like a speech bubble, add the `::after` pseudo-element with the `content` property to the tooltip. The arrow itself is made with borders: when combined with the `content`, the entire tooltip becomes a speech bubble. [S1]
|
||||
|
||||
**Positioning principle**
|
||||
Position the arrow inside the tooltip: `top: 100%` will place the arrow at the bottom of the tooltip, and `left: 50%` will center the arrow. The `border-width` property specifies the size of the arrow; if you change this, also change the `margin` value so the arrow stays centered. The `border-color` is used to turn the content into an arrow — set the relevant side to the tooltip's background color and the rest to `transparent`. [S1]
|
||||
|
||||
**Bottom arrow (arrow points down, tooltip above the trigger):**
|
||||
```css
|
||||
.tooltiptext::after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
border-color: black transparent transparent transparent;
|
||||
}
|
||||
```
|
||||
|
||||
**Top arrow (arrow points up, tooltip below the trigger):**
|
||||
```css
|
||||
.tooltiptext::after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
border-color: transparent transparent black transparent;
|
||||
}
|
||||
```
|
||||
|
||||
**Left arrow (arrow points left, tooltip to the right of the trigger):**
|
||||
```css
|
||||
.tooltiptext::after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 100%;
|
||||
margin-top: -5px;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
border-color: transparent black transparent transparent;
|
||||
}
|
||||
```
|
||||
|
||||
**Right arrow (arrow points right, tooltip to the left of the trigger):**
|
||||
```css
|
||||
.tooltiptext::after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 100%;
|
||||
margin-top: -5px;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
border-color: transparent transparent transparent black;
|
||||
}
|
||||
```
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
The four `::after` rules above are the source's applied examples, each extending a positioned tooltip with a directional arrow. No external project/commit applications found in the source.
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Generic arrow-via-border pattern (language: CSS):
|
||||
```css
|
||||
.tooltiptext::after {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
/* color exactly one side; the others transparent */
|
||||
border-color: black transparent transparent transparent;
|
||||
}
|
||||
```
|
||||
|
||||
## ⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
|
||||
The four arrow variants differ only in two choices: (1) the anchor edge of the `::after` element — `top: 100%` (bottom arrow), `bottom: 100%` (top arrow), `right: 100%` (left arrow), `left: 100%` (right arrow) — and (2) which `border-color` side is opaque. Choose the direction so the arrow points toward the trigger, matching the tooltip's own placement from [[CSS Tooltips]]. Use `margin-left` to recenter horizontal-edge arrows and `margin-top` to recenter vertical-edge arrows. [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 Tooltips]], [[CSS Pseudo-elements]], [[CSS Border]], [[CSS Position]]
|
||||
- **참조 맥락:** Referenced when a tooltip needs a visual pointer connecting it to its trigger element.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — CSS Tooltip Arrows — https://www.w3schools.com/css/css_tooltip_arrows.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Tooltip Arrows" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user