Files
2nd/10_Wiki/Dev/Topic_W3CSS/W3CSS_Sidebar.md
T
Antigravity Agent 1cfd3bbb56 docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고,
Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
2026-07-05 00:10:59 +09:00

84 lines
5.2 KiB
Markdown

---
id: w3css-sidebar
title: "W3CSS Sidebar"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["w3-sidebar", "w3-overlay", "side navigation", "W3.CSS 사이드바"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.87
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["w3css", "css-framework", "w3schools", "sidebar", "navigation"]
raw_sources: ["https://www.w3schools.com/w3css/w3css_sidebar.asp"]
applied_in: []
github_commit: ""
---
# [[W3CSS Sidebar]]
## 🎯 한 줄 통찰 (One-line insight)
"Open over content" and "slide content to the right" are NOT the same interaction despite looking similar — the former only toggles the sidebar's own `display`, while the latter additionally animates the MAIN content's `margin-left`, meaning a push-style sidebar requires coordinating two separate elements' styles in the same JS function, not just revealing the sidebar itself. [S1]
## 🧠 핵심 개념 (Core concepts)
- **`w3-sidebar`** — the base class for a vertical, typically fixed-position side navigation panel. [S1]
- **Six distinct sidebar interaction patterns** — always-visible, collapsible-responsive, overlay-over-part, overlay-over-all, slide-content-right, and right-side instead of left. [S1]
- **`margin-left` reservation** — an always-visible sidebar requires the adjacent content div to have a matching `margin-left` (e.g. sidebar `width:25%` pairs with content `margin-left:25%`) so content doesn't render underneath it. [S1]
- **`w3-collapse`** — combined with `w3-hide-large`, creates a sidebar that's always visible on large screens but hidden/toggle-controlled on small screens. [S1]
- **`w3-overlay`** — adds a semi-transparent (50% opacity) black layer over page content while the sidebar is open, visually emphasizing the open sidebar without changing its position. [S1]
- **Right-side placement** — simply swapping `style="left:0"` for `style="right:0"` (or omitting `left` and adding `right:0`) relocates the entire sidebar system to the opposite edge. [S1]
## 📖 세부 내용 (Details)
- Always-visible sidebar with reserved content margin: `<div class="w3-sidebar w3-bar-block" style="width:25%">...</div><div style="margin-left:25%">... page content ...</div>`. [S1]
- Slide-content-right (distinct from simple overlay): `function w3_open() { document.getElementById("main").style.marginLeft = "25%"; document.getElementById("mySidebar").style.width = "25%"; document.getElementById("mySidebar").style.display = "block"; }` — moves BOTH the sidebar and the main content. [S1]
- Overlay effect: `<div class="w3-overlay" onclick="w3_close()" style="cursor:pointer" id="myOverlay"></div>` shown/hidden alongside the sidebar via the same open/close functions. [S1]
- Collapsible responsive sidebar: `<div class="w3-sidebar w3-bar-block w3-collapse w3-card" style="width:200px;" id="mySidebar"><button class="w3-bar-item w3-button w3-hide-large" onclick="w3_close()">Close &times;</button>...</div>` paired with a `w3-main` content div using matching `margin-left`. [S1]
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
- **오버레이 vs 콘텐츠 밀기의 차이**: 단순 오버레이는 사이드바의 display만 바꾸지만, "슬라이드" 방식은 사이드바뿐 아니라 메인 콘텐츠의 marginLeft까지 함께 변경해야 한다는 구현 차이가 있음. [S1]
## 🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — w3-overlay로 사이드바 오픈 시 배경을 어둡게 처리해 시선을 집중시키는 패턴이 모바일 메뉴 UX의 대표 실전 기법이다. [S1]
## 💻 코드 패턴 (Code patterns)
Sidebar with a semi-transparent overlay over the page content (HTML/JS):
```html
<div class="w3-sidebar w3-bar-block" style="display:none;z-index:5" id="mySidebar">
<button class="w3-bar-item w3-button" onclick="w3_close()">Close</button>
<a href="#" class="w3-bar-item w3-button">Link 1</a>
</div>
<div class="w3-overlay" onclick="w3_close()" style="cursor:pointer" id="myOverlay"></div>
<script>
function w3_open() {
document.getElementById("mySidebar").style.display = "block";
document.getElementById("myOverlay").style.display = "block";
}
function w3_close() {
document.getElementById("mySidebar").style.display = "none";
document.getElementById("myOverlay").style.display = "none";
}
</script>
```
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.87
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[W3.CSS Tutorial]]
- **관련 개념:** [[W3CSS Navigation]], [[W3CSS Accordions]], [[W3CSS Dropdowns]], [[W3CSS Tabulators]]
- **참조 맥락:** Navigation Components 섹션 마지막 — UI Components 섹션의 탭(Tabulators) 챕터로 이어짐.
## 📚 출처 (Sources)
- [S1] W3Schools — W3.CSS Sidebar — https://www.w3schools.com/w3css/w3css_sidebar.asp
## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "W3.CSS Sidebar" page (Astra wiki-curation, P-Reinforce v3.1 format).