--- id: css-masking-with-png title: "CSS Masking with PNG" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["mask-image", "PNG mask", "CSS masking", "mask-repeat", "mask-position"] 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", "mask-image", "images"] raw_sources: ["https://www.w3schools.com/css/css3_masking.asp"] applied_in: [] github_commit: "" --- # [[CSS Masking with PNG]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) CSS masking creates a mask layer placed over an element to partially or fully hide portions of it; a PNG image can serve as that mask layer via the `mask-image` property. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **CSS masking** β€” lets you create a mask layer to place over an element to partially or fully hide portions of the element. [S1] - **`mask-image`** β€” specifies a mask layer image; it can use a PNG image, an SVG image, a CSS gradient, or an SVG `` element. [S1] - **Transparency rule** β€” the mask image needs a transparent or semi-transparent area; black indicates fully transparent. [S1] - **`-webkit-` prefix** β€” examples pair `mask-image` with `-webkit-mask-image` for browser support. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **PNG as mask** β€” set both `-webkit-mask-image` and `mask-image` to `url(...)` pointing at a PNG with transparent regions. [S1] - **Control tiling** β€” add `mask-repeat: no-repeat;` to stop the mask image from tiling across the element. [S1] - **Control placement** β€” add `mask-position` (e.g. `center`) to set where the mask image starts. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **What CSS masking is** β€” CSS masking allows you to create a mask layer to place over an element to partially or fully hide portions of the element. The `mask-image` property specifies a mask layer image, which can be a PNG image, an SVG image, a CSS gradient, or an SVG `` element. [S1] **Using a PNG image as the mask layer** β€” The mask image needs to have a transparent or semi-transparent area. Black indicates fully transparent. [S1] ```css .mask1 { -webkit-mask-image: url(w3logo.png); mask-image: url(w3logo.png); mask-repeat: no-repeat; } ``` **Repeating mask layer images** β€” when `mask-repeat` is omitted, the mask image will be repeated all over the image. [S1] ```css .mask1 { -webkit-mask-image: url(w3logo.png); mask-image: url(w3logo.png); } ``` **Positioning mask images** β€” the `mask-position` property sets the starting position of a mask image. [S1] ```css .mask1 { -webkit-mask-image: url(w3logo.png); mask-image: url(w3logo.png); mask-repeat: no-repeat; mask-position: center; } ``` **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: applying the `w3logo.png` PNG as a mask layer over a photograph, with `no-repeat`, default repeat, and centered positioning. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Apply a non-repeating PNG mask layer (language: CSS): ```css .mask1 { -webkit-mask-image: url(w3logo.png); mask-image: url(w3logo.png); mask-repeat: no-repeat; } ``` ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (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 Gradients]], [[CSS Masking SVG]], [[CSS Image Shapes]] - **μ°Έμ‘° λ§₯락:** Referenced when hiding portions of an element using a PNG-based mask layer. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” CSS Masking with PNG β€” https://www.w3schools.com/css/css3_masking.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "CSS Masking with PNG" page (Astra wiki-curation, P-Reinforce v3.1 format).