--- 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

This is some text that is placed in the transparent box.

``` ## πŸ› οΈ 적용 사둀 (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).