Output 2: Responsive Navigation Bar

Responsive Navigation Bar

Resize your window to see the navigation bar adapt to different screen sizes

Responsive Features: On desktop, the menu is visible with a search bar. On mobile (smaller screens), a toggle menu button (☰) appears to save space. Try resizing your browser window to see the transition.

Source Code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Responsive Navigation Bar</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <nav class="navbar">
        <div class="logo">Logo</div>
        <div class="nav-links" id="navLinks">
            <a href="#">Link1</a>
            <a href="#">Link2</a>
            <a href="#">Link3</a>
        </div>
        <div class="search-bar">
            <input type="text" placeholder="Search...">
        </div>
        <div class="menu-icon" onclick="toggleMenu()">☰</div>
    </nav>
    <script src="script.js"></script>
</body>
</html>