Files
2nd/10_Wiki/Topic_CSS/CSS_Masking_PNG.md
T
koriweb 9609c04755 docs(10_Wiki): W3Schools 위키화 — HTML/CSS/JavaScript(core)
W3Schools 튜토리얼을 P-Reinforce v3.1 포맷으로 위키화(영어 본문, 한/영 섹션 헤더).
- Topic_HTML: 59문서 (튜토리얼+예제, 레퍼런스/메타 제외)
- Topic_CSS: 190문서 (메인 + Advanced/Flexbox/Grid/RWD 전체)
- Topic_JavaScript: 120문서 (코어 언어; Temporal/DOM상세/BOM/WebAPI/AJAX/jQuery/Graphics 등은 후속)
각 폴더 00_INDEX.md(MOC) 포함. 코드 verbatim, 미확인분은 "Not found in source" 표기.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:21:18 +09:00

115 lines
5.1 KiB
Markdown

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