Files
2nd/10_Wiki/Dev/Topic_HOWTO/HOWTO_CSS_Fixed_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

3.9 KiB

id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
id title category status verification_status canonical_id aliases duplicate_of source_trust_level confidence_score created_at updated_at review_reason merge_history tags raw_sources applied_in github_commit
howto-css-fixed-sidebar How To - Fixed Sidebar Web_Recipes draft conceptual
sidenav CSS
fixed side navigation
B 0.83 2026-07-04 2026-07-04
howto
css
w3schools
layout
position
navigation
sidebar
https://www.w3schools.com/howto/howto_css_fixed_sidebar.asp

HOWTO CSS Fixed Sidebar

🎯 한 줄 통찰 (One-line insight)

Just like the fixed-top-menu recipe, this pattern requires the SAME manual "keep two numbers in sync" discipline — the sidebar's width and the main content's margin-left must match exactly, or the content either overlaps the sidebar (margin too small) or leaves an awkward gap (margin too large); z-index: 1 is also added here specifically because the sidebar sits alongside scrollable content rather than above/below it, making stacking order collisions more likely than in the top/bottom fixed-menu case. [S1]

🧠 핵심 개념 (Core concepts)

  • position: fixed; top: 0; left: 0; — pins the sidebar to the left edge of the viewport. [S1]
  • z-index: 1 — ensures the sidebar stays above other page content in stacking order. [S1]
  • overflow-x: hidden — prevents horizontal scrollbars from appearing inside the fixed sidebar. [S1]
  • Matching margin-left on .main — must equal the sidebar's declared width (e.g. both 160px) to avoid overlap. [S1]
  • Full-height vs. auto-height variantsheight: 100% makes the sidebar span the entire viewport height; omitting it lets the sidebar size to its own content instead. [S1]
  • Small-screen responsiveness@media screen and (max-height: 450px) reduces padding/font-size on short viewports (not a width breakpoint — a HEIGHT breakpoint, unusual compared to most responsive recipes in this cookbook). [S1]

📖 세부 내용 (Details)

  • Full example: .sidenav { height: 100%; width: 160px; position: fixed; z-index: 1; top: 0; left: 0; background-color: #111; overflow-x: hidden; padding-top: 20px; } .sidenav a { padding: 6px 8px 6px 16px; color: #818181; display: block; } .main { margin-left: 160px; padding: 0px 10px; }. [S1]
  • Short-viewport adjustment: @media screen and (max-height: 450px) { .sidenav { padding-top: 15px; } .sidenav a { font-size: 18px; } }. [S1]

⚖️ 모순 및 업데이트 (Contradictions & updates)

없음 — 신규 레시피, 기존 문서와 모순되는 내용 없음.

🛠️ 적용 사례 (Applied in summary)

About/Services/Clients/Contact 링크가 담긴 좌측 고정 사이드바를 만들고, 본문에 동일한 margin-left를 줘 겹치지 않게 하는 예제가 원문에서 직접 제시됨. [S1]

💻 코드 패턴 (Code patterns)

Fixed sidebar with matching content margin (CSS):

.sidenav {
  height: 100%;
  width: 160px;
  position: fixed;
  z-index: 1;
  top: 0; left: 0;
  overflow-x: hidden;
}
.main {
  margin-left: 160px; /* must match sidenav width */
}

검증 상태 및 신뢰도

  • 상태: draft
  • 검증 단계: conceptual
  • 출처 신뢰도: B (W3Schools — widely used educational reference)
  • 신뢰 점수: 0.83
  • 중복 검사 결과: 신규 생성 (New discovery)

🔗 지식 그래프 (Knowledge Graph)

📚 출처 (Sources)

📝 변경 이력 (Change history)

  • 2026-07-04: Initial draft synthesized from the W3Schools "How To - Fixed Sidebar" recipe (Astra wiki-curation, P-Reinforce v3.1 format).