Q1. How do you create a fixed navbar?
Use position: fixed; top: 0; width: 100%; Also add padding-top to body to prevent content hiding.
Q2. How do you create a sticky navbar?
Use position: sticky; top: 0; It scrolls normally until reaching top, then sticks.
Q3. What's the difference between fixed and sticky?
Fixed is always relative to viewport. Sticky is relative until scroll threshold, then becomes fixed-like.
Q4. Why add margin-top to body for fixed navbar?
Fixed navbar removes itself from flow, so content starts at top and gets hidden. margin-top pushes content down.
Q5. Can you have a fixed bottom navbar?
Yes, use position: fixed; bottom: 0; left: 0; width: 100%;
