--- id: css-border-images title: "CSS Border Images" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["border-image", "border-image-source", "border-image-slice", "border-image-repeat", "CSS image border", "nine-slice border"] 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", "border-image", "borders"] raw_sources: ["https://www.w3schools.com/css/css3_border_images.asp"] applied_in: [] github_commit: "" --- # [[CSS Border Images]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The `border-image` property lets you use an image as the border around an element instead of a normal border, slicing the image into nine sections so corners stay fixed while the sides repeat, round, or stretch. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`border-image`** β€” defines an image to be used as the border around an element, instead of the normal border. [S1] - **Nine-slice model** β€” the image is sliced into nine sections (like a tic-tac-toe board); corners are placed at the corners, and the middle sections are repeated or stretched. [S1] - **`border` prerequisite** β€” for `border-image` to work, the element also needs the `border` property set. [S1] - **Shorthand** β€” `border-image` is shorthand for `border-image-source`, `border-image-slice`, `border-image-width`, `border-image-outset`, and `border-image-repeat`. [S1] - **Repeat behaviors** β€” sides can be repeated, rounded, or stretched. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Slice-and-place pattern** β€” slice once, then corners pin while edges tile/stretch to fill any border length. [S1] - **Transparent base border pattern** β€” examples set a transparent `border` (e.g., `10px solid transparent`) so the image border fills space the regular border reserves. [S1] - **Slice-value pattern** β€” the slice value (a unitless number or a percentage like `20%`/`30%`) controls how much of the image becomes corners vs. edges. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **CSS `border-image` Property** The `border-image` property allows you to define an image to be used as the border around an element, instead of the normal border. The image is sliced into nine sections (like a tic-tac-toe board), with the corners placed at the corners and the middle sections repeated or stretched. [S1] **Note:** For `border-image` to work, the element also needs the `border` property set! [S1] The `border-image` property is a shorthand for the following: [S1] - `border-image-source` β€” defines the path to the image. [S1] - `border-image-slice` β€” defines how to slice the image. [S1] - `border-image-width` β€” defines the width of the image. [S1] - `border-image-outset` β€” defines the amount by which the border image area extends beyond the border box. [S1] - `border-image-repeat` β€” defines whether the image is repeated, rounded, or stretched. [S1] Example β€” image border with `round`: [S1] ```css #borderimg { border: 10px solid transparent; padding: 15px; border-image: url(border.png) 30 round; } ``` Example β€” image border with `stretch`: [S1] ```css #borderimg { border: 10px solid transparent; padding: 15px; border-image: url(border.png) 30 stretch; } ``` Example β€” different slice values across multiple elements: [S1] ```css #borderimg1 { border: 10px solid transparent; padding: 15px; border-image: url(border.png) 50 round; } #borderimg2 { border: 10px solid transparent; padding: 15px; border-image: url(border.png) 20% round; } #borderimg3 { border: 10px solid transparent; padding: 15px; border-image: url(border.png) 30% round; } ``` **CSS Border Image Properties** | Property | Description | |----------|-------------| | `border-image` | Shorthand for all the border-image-* properties | | `border-image-source` | Specifies the path to the image used as a border | | `border-image-slice` | Specifies how to slice the border image | | `border-image-width` | Specifies the widths of the border image | | `border-image-outset` | Specifies the amount by which the border image area extends beyond the border box | | `border-image-repeat` | Specifies whether the border image should be repeated, rounded, or stretched | [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) The page's own examples are the applied cases: a single image border with `round` and with `stretch`, plus three elements using different slice values (`50`, `20%`, `30%`). No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Basic image border (language: CSS) β€” note the required transparent `border`: ```css selector { border: 10px solid transparent; padding: 15px; border-image: url(border.png) 30 round; } ``` Stretched variant: ```css selector { border: 10px solid transparent; padding: 15px; border-image: url(border.png) 30 stretch; } ``` ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (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 Rounded Corners]], [[CSS Multiple Backgrounds]], [[CSS Background Size]] - **μ°Έμ‘° λ§₯락:** Referenced when an element needs a decorative or themed border that a solid color cannot provide. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Border Images β€” https://www.w3schools.com/css/css3_border_images.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Border Images" page (Astra wiki-curation, P-Reinforce v3.1 format).