---
id: howto-css-fixed-menu
title: "How To - Fixed Menu"
category: "Web_Recipes"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["fixed navbar CSS", "sticky top menu"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.84
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["howto", "css", "w3schools", "layout", "position", "navigation"]
raw_sources: ["https://www.w3schools.com/howto/howto_css_fixed_menu.asp"]
applied_in: []
github_commit: ""
---

# [[HOWTO CSS Fixed Menu]]

## 🎯 한 줄 통찰 (One-line insight)
The recipe explicitly warns that a fixed navbar OVERLAYS page content underneath it (since `position: fixed` removes the element from flow, other content doesn't "know" to leave room for it) — the fix is a manual `margin-top` on the main content equal to or greater than the navbar's height, meaning every fixed-menu layout requires the developer to keep two separate numbers (navbar height, content margin) in sync by hand, with no built-in mechanism linking them. [S1]

## 🧠 핵심 개념 (Core concepts)
- **`position: fixed; top: 0;`** — pins the menu to the top of the VIEWPORT, staying visible during scroll. [S1]
- **Overlay problem** — a fixed element doesn't push other content down; without compensation, the fixed menu covers the top of the page content. [S1]
- **Manual `margin-top` fix** — the main content block needs `margin-top` at least equal to the navbar's rendered height to avoid being hidden underneath it. [S1]
- **Bottom variant** — swapping `top: 0` for `bottom: 0` creates a fixed BOTTOM menu instead, with the equivalent fix being `margin-bottom` on the main content. [S1]

## 📖 세부 내용 (Details)
- Fixed top menu: `.navbar { position: fixed; top: 0; width: 100%; overflow: hidden; background-color: #333; } .navbar a { float: left; padding: 14px 16px; color: #f2f2f2; } .main { margin-top: 30px; }`. [S1]
- Fixed bottom menu: `.navbar { position: fixed; bottom: 0; width: 100%; } .main { margin-bottom: 30px; }`. [S1]

## ⚖️ 모순 및 업데이트 (Contradictions & updates)
없음 — 신규 레시피, 기존 문서와 모순되는 내용 없음.

## 🛠️ 적용 사례 (Applied in summary)
Home/News/Contact 링크가 담긴 상단 고정 메뉴를 만들고, 콘텐츠가 가려지지 않도록 margin-top을 추가하는 예제가 원문에서 직접 제시됨. [S1]

## 💻 코드 패턴 (Code patterns)
Fixed top navbar requiring a manual content offset (CSS):
```css
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: #333;
}
.main {
  margin-top: 30px; /* must match or exceed navbar height */
}
```

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

## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[W3Schools HOW TO]]
- **관련 개념:** [[HOWTO CSS Fixed Footer]], [[HOWTO CSS Fixed Sidebar]], [[HOWTO JS Navbar Sticky]]
- **참조 맥락:** CSS Layout & Positioning 섹션.

## 📚 출처 (Sources)
- [S1] W3Schools — How To - Fixed Menu — https://www.w3schools.com/howto/howto_css_fixed_menu.asp

## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "How To - Fixed Menu" recipe (Astra wiki-curation, P-Reinforce v3.1 format).
