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>
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
---
|
||||
id: css-opacity
|
||||
title: "CSS Opacity"
|
||||
category: "Frontend"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["opacity", "transparency", "image transparency", "rgba opacity", "transparent box"]
|
||||
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", "opacity", "transparency"]
|
||||
raw_sources: ["https://www.w3schools.com/css/css_image_transparency.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[CSS Opacity]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
The `opacity` property sets how transparent an element is on a 0.0–1.0 scale, but because it affects the whole element (including children), `rgba()` is preferred when only the background should be see-through. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **`opacity` property** — specifies the opacity/transparency of an element. [S1]
|
||||
- **Value range** — 0.0 is completely transparent, 1.0 is fully opaque. [S1]
|
||||
- **Hover interaction** — opacity can change on `:hover` to fade images in or out. [S1]
|
||||
- **RGBA alternative** — `rgba()` adds a fourth alpha value (0.0–1.0) to a color, making only that color transparent. [S1]
|
||||
|
||||
## 🧩 추출된 패턴 (Extracted patterns)
|
||||
- **Fade-on-hover** — pair a base `opacity` with an `:hover` opacity to brighten or dim images on pointer-over. [S1]
|
||||
- **Transparent background only** — use `rgba()` on `background-color` so the text/children stay fully opaque while the background is see-through. [S1]
|
||||
- **Text-in-transparent-box** — layer a `transbox` with an `rgba()` background over a patterned background `div`. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
**Opacity property** [S1]
|
||||
The `opacity` property specifies the opacity/transparency of an element. It can take a value from 0.0 to 1.0, where 0.0 is completely transparent and 1.0 is fully opaque.
|
||||
|
||||
Basic image opacity:
|
||||
```css
|
||||
img {
|
||||
opacity: 0.5;
|
||||
}
|
||||
```
|
||||
|
||||
Transparent image that becomes opaque on hover:
|
||||
```css
|
||||
img {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
img:hover {
|
||||
opacity: 1.0;
|
||||
}
|
||||
```
|
||||
|
||||
Reversed hover effect (opaque image fades on hover):
|
||||
```css
|
||||
img:hover {
|
||||
opacity: 0.5;
|
||||
}
|
||||
```
|
||||
|
||||
Transparent box:
|
||||
```css
|
||||
div {
|
||||
opacity: 0.3;
|
||||
}
|
||||
```
|
||||
|
||||
**Transparency using RGBA** [S1]
|
||||
RGBA color values add a fourth alpha channel that specifies the opacity of the color, so only the background becomes transparent:
|
||||
```css
|
||||
div {
|
||||
background: rgba(4, 170, 109, 0.3) /* Green background with 30% opacity */
|
||||
}
|
||||
```
|
||||
|
||||
**Text in a transparent box** [S1]
|
||||
```html
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
div.background {
|
||||
background: url(klematis.jpg) repeat;
|
||||
border: 2px solid black;
|
||||
}
|
||||
|
||||
div.transbox {
|
||||
margin: 30px;
|
||||
background-color: rgba(255, 255, 255, 0.6);
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
div.transbox p {
|
||||
margin: 5%;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="background">
|
||||
<div class="transbox">
|
||||
<p>This is some text that is placed in the transparent box.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
The page's applied examples are the half-opacity image, hover fade-in/fade-out images, the 30%-opacity `div`, the RGBA green background, and the text-in-transparent-box layout. No external project/commit applications found in the source.
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Fade image in on hover (language: CSS):
|
||||
```css
|
||||
img {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
img:hover {
|
||||
opacity: 1.0;
|
||||
}
|
||||
```
|
||||
Transparent background only, via RGBA (language: CSS):
|
||||
```css
|
||||
div {
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
```
|
||||
|
||||
## ⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
|
||||
- **`opacity` vs `rgba()`** — The source distinguishes the two: `opacity` applies to the whole element and is shown fading entire images/boxes, whereas the "Transparency using RGBA" approach applies the alpha only to a color so a background can be transparent without dimming its content. Use `opacity` to fade an element as a whole; use `rgba()` when only the background color should be transparent (as in the text-in-transparent-box example). [S1]
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (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 Colors]], [[CSS Backgrounds]], [[CSS Images]]
|
||||
- **참조 맥락:** Referenced when fading elements or making backgrounds see-through.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — CSS Opacity — https://www.w3schools.com/css/css_image_transparency.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Opacity" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user