Responsive Navigation Bar for Portfolio Website

Introduction

In 2025, creating a professional portfolio website that adapts to all devices is essential. One of the most important UI components is a responsive navigation bar. Whether you’re a developer, designer, or freelancer, this guide will help you build a sleek and mobile-friendly navbar from scratch using HTML and CSS — no JavaScript required.

Why Responsive Navigation Bars Matter

  • Improve user experience on both desktop and mobile devices
  • Boost SEO rankings and Google Core Web Vitals
  • Give your site a clean, professional look

HTML Structure

Here’s the basic HTML structure for the navigation bar:

<!-- Navigation Bar Wrapper -->
<nav class="navbar">
  <div class="logo">MyPortfolio</div>

  <ul class="nav-links">
    <li><a href="#">Home</a></li>
    <li><a href="#">Projects</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Contact</a></li>
  </ul>
</nav>

CSS Styling

Style the navbar using the following responsive CSS:

.navbar {
  background-color: #1e3a8a;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
}

.logo {
  font-size: 20px;
  font-weight: bold;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
}

.nav-links li a {
  color: white;
  text-decoration: none;
  font-weight: 500;
}

@media (max-width: 768px) {
  .nav-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

Live Demo + Source Code

You can preview the navigation bar below. Want to copy or customize it? The full source is available on GitHub.

View Full Source Code: Click here on GitHub Gist

Conclusion

Now you’ve created a clean and responsive navigation bar using only HTML and CSS. You can extend it with JavaScript, animations, dropdowns, and more — but this is a perfect base for modern portfolio or business websites in 2025.

Comments