--- id: css-outline-offset title: "CSS Outline Offset" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["outline-offset", "outline offset", "outline spacing", "transparent outline gap", "negative outline offset"] 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", "outline", "outline-offset"] raw_sources: ["https://www.w3schools.com/css/css_outline_offset.asp"] applied_in: [] github_commit: "" --- # [[CSS Outline Offset]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The `outline-offset` property adds transparent space between an element's outline and its border/edge, and accepts negative values to pull the outline inside the border. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Purpose** β€” `outline-offset` creates space between an element's outline and its border/edge. [S1] - **Transparent space** β€” the space created remains transparent. [S1] - **Positive values** β€” push the outline outward, away from the border. [S1] - **Negative values** β€” place the outline inside the border edge. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Outward gap pattern** β€” combine `outline` with a positive `outline-offset` to float the outline away from the border. [S1] - **Inward inset pattern** β€” use a negative `outline-offset` (e.g., `-5px`) to draw the outline inside the element's border. [S1] - **Reveal-the-gap pattern** β€” apply a `background` so the transparent offset space between border and outline is visible. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) The `outline-offset` property creates space between an element's outline and its border/edge. This space remains transparent. [S1] **Example 1 β€” Positive offset:** creates a red outline 15px outside the border. [S1] ```css p { margin: 30px; padding: 5px; border: 1px solid black; outline: 3px solid red; outline-offset: 15px; } ``` **Example 2 β€” With background:** demonstrates the transparent space between border and outline. [S1] ```css p { margin: 30px; padding: 5px; background: yellow; border: 1px solid black; outline: 3px solid red; outline-offset: 15px; } ``` **Example 3 β€” Negative offset:** places the outline inside the border edge using a negative value. [S1] ```css p { margin: 30px; padding: 5px; background: yellow; border: 1px solid black; outline: 3px solid red; outline-offset: -5px; } ``` **Related outline properties** listed on the page: `outline`, `outline-color`, `outline-offset`, `outline-style`, and `outline-width`. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) The page's own examples are the applied cases: a positive 15px offset, the same with a yellow background to expose the transparent gap, and a negative βˆ’5px offset placing the outline inside the border. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Offset pattern (language: CSS): ```css selector { outline: