--- id: css-masking-with-svg title: "CSS Masking with SVG" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["SVG mask", "svg mask element", "mask-image svg", "CSS masking SVG", "svg clip shapes"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.87 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["css", "web", "frontend", "w3schools", "masking", "svg", "mask-image"] raw_sources: ["https://www.w3schools.com/css/css3_masking_svg.asp"] applied_in: [] github_commit: "" --- # [[CSS Masking with SVG]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) An SVG `` element can act as a mask layer for an image, using SVG shapes (circle, ellipse, polygon) to define which parts of the image are revealed. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **SVG mask layer** β€” an SVG `` element can serve as the mask layer applied to an image. [S1] - **Shape-driven** β€” the visible region is defined by SVG shapes (``, ``, ``) filled with `#ffffff` inside the mask. [S1] - **Wiring** β€” the image references the mask via `mask="url(#svgmask1)"`, where the id matches the `` element's id. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Define-then-reference** β€” declare a `` containing white-filled shapes, then point the ``'s `mask` attribute at `url(#id)`. [S1] - **Composite masks** β€” multiple shapes (e.g. several ``s) inside one `` reveal multiple regions at once. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) This page demonstrates how to apply SVG mask layers to images using various SVG shapes. Each example defines an SVG `` with one or more white-filled (`#ffffff`) shapes, then applies it to an `` via `mask="url(#svgmask1)"`. [S1] **Circle mask** [S1] ```html ``` **Ellipse mask** [S1] ```html ``` **Triangle mask** [S1] ```html ``` **Star mask** [S1] ```html ``` **Multiple circles mask** [S1] ```html ``` **CSS masking properties reference** [S1] | Property | Description | |---|---| | `mask-clip` | Specifies which area is affected by a mask image | | `mask-composite` | Specifies a compositing operation used on the current mask layer with the mask layers below it | | `mask-image` | Specifies an image to be used as a mask layer for an element | | `mask-mode` | Specifies whether the mask layer image is treated as a luminance mask or as an alpha mask | | `mask-origin` | Specifies the origin position (the mask position area) of a mask layer image | | `mask-position` | Sets the starting position of a mask layer image (relative to the mask position area) | | `mask-repeat` | Specifies how the mask layer image is repeated | | `mask-size` | Specifies the size of a mask layer image | | `mask-type` | Specifies whether an SVG `` element is treated as a luminance mask or as an alpha mask | ## πŸ› οΈ 적용 사둀 (Applied in summary) The page's own examples are the applied cases: SVG `` layers (circle, ellipse, triangle, star, multiple circles) applied to the `img_5terre.jpg` image. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Reveal a circular region of an image with an SVG mask (language: HTML/SVG): ```html ``` ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) No contradictions found in the source. ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual (μ‹€μ œ 적용 사둀 발견 μ‹œ applied/validated둜 승격 κ°€λŠ₯) - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.87 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[CSS Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSS Masking PNG]], [[CSS Masking Gradients]], [[CSS Image Shapes]] - **μ°Έμ‘° λ§₯락:** Referenced when masking an image to arbitrary shapes defined by SVG geometry. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Masking with SVG β€” https://www.w3schools.com/css/css3_masking_svg.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Masking with SVG" page (Astra wiki-curation, P-Reinforce v3.1 format).