Interview Question

How do you create a responsive navbar?

Use semantic links and flexible CSS, with an accessible menu button when needed.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

A responsive navbar keeps navigation usable on both wide and narrow screens. • Use semantic `<nav>` markup, flexible CSS, and a real button for a collapsible menu. • Prefer native HTML elements before adding custom scripted behavior. • Test the result with a keyboard, a small screen, and browser developer tools.

💡 Simple Example

<nav aria-label="Main"><a href="/">Home</a><a href="/about">About</a></nav>

⚡ Quick Revision

Use semantic links and flexible CSS, with an accessible menu button when needed.