--- 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).