You are currently viewing CSS Cheat Sheet 174: CSS Vertical Navigation Bar

CSS Cheat Sheet 174: CSS Vertical Navigation Bar

Creating a Stylish Vertical Navigation Bar with CSS

In the ever-evolving landscape of web design, mastering the art of CSS (Cascading Style Sheets) is paramount, and one essential element every web designer should be well-versed in is the CSS Vertical Navigation Bar. This elegant and space-saving navigation style not only provides a seamless user experience but also adds a touch of sophistication to your web projects. In this comprehensive tutorial, we will guide you through the step-by-step process of creating a CSS Vertical Navigation Bar, catering to both beginners and those looking to refine their CSS skills. By the end of this tutorial, you’ll have the proficiency to craft captivating and functional vertical navigation bars that elevate your web designs.

Whether you’re a budding web developer or an experienced designer seeking to enhance your CSS expertise, this tutorial is your gateway to understanding the principles behind CSS Vertical Navigation Bars. We’ll start with the fundamentals, covering the HTML structure necessary to set the stage for your navigation bar. Then, we’ll delve into the world of CSS to impart styling techniques that will transform a basic list of links into a sleek and aesthetically pleasing vertical navigation bar. Our step-by-step guidance, complete with code snippets and explanations, ensures that you not only learn how to create these navigation bars but also grasp the underlying concepts, empowering you to customize and expand upon your newfound skills. So, let’s embark on this journey to master the art of creating captivating CSS Vertical Navigation Bars.

Vertical Navigation Bar


Before we dive into creating a CSS vertical navigation bar, it’s essential to have a basic understanding of HTML and CSS. If you are not familiar with these technologies, I recommend checking out introductory tutorials on HTML and CSS before proceeding.

Step 1: Setting Up the HTML Structure

First, let’s create the HTML structure for our navigation bar. Open your favorite code editor and create a new HTML file (e.g., index.html). Use the following code as a template:

<!DOCTYPE html>
    <link rel="stylesheet" type="text/css" href="styles.css">
    <div class="navbar">
            <li><a href="#">Home</a></li>
            <li><a href="#">About</a></li>
            <li><a href="#">Services</a></li>
            <li><a href="#">Portfolio</a></li>
            <li><a href="#">Contact</a></li>

In this code, we have created a basic HTML structure that includes a div element with the class “navbar” and an unordered list (<ul>) containing list items (<li>) for each navigation item. You can add more items as needed.

Step 2: Styling the Navigation Bar

Now, let’s move on to the CSS part. Create a new CSS file (e.g., styles.css) and link it to your HTML document as shown in the <head> section of the HTML code.

In your CSS file, add the following code to style the navigation bar:

/* Reset default list styles */
ul {
    list-style-type: none;
    padding: 0;
    margin: 0;

/* Style the navigation bar */
.navbar {
    background-color: #333;
    width: 200px; /* Adjust the width as needed */
    color: #fff;

/* Style the navigation links */
.navbar a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #fff;

/* Change link color on hover */
.navbar a:hover {
    background-color: #555;

In this CSS code:

  • We reset the default list styles for the unordered list.
  • We style the .navbar class, setting the background color, width, and text color.
  • We style the navigation links inside the .navbar class, defining padding, text decoration, and text color.
  • We change the link color when hovering over it to provide visual feedback.

Step 3: Preview Your Vertical Navigation Bar

To see your vertical navigation bar in action, open the HTML file in a web browser. You should now have a stylish and functional vertical navigation bar on your webpage.


In the realm of web design, the ability to craft a compelling and functional CSS Vertical Navigation Bar is a skill that sets you on a path to creating visually captivating and user-friendly websites. This tutorial has taken you through a comprehensive journey from HTML structure to CSS styling, equipping you with the knowledge to bring your design visions to life. The elegant simplicity of a vertical navigation bar not only optimizes screen space but also adds a touch of sophistication to your web projects. With these newfound skills, you have the power to elevate your web designs and create seamless, user-friendly navigation experiences.

Remember that the key to mastering CSS Vertical Navigation Bars lies not only in following the steps outlined in this tutorial but also in experimentation and creative exploration. As you continue to work with CSS, consider how you can further customize and enhance your navigation bar to suit the unique requirements of your projects. The world of web design is vast and ever-evolving, and your proficiency in CSS will continue to be a valuable asset as you embark on your journey to create stunning websites. So, go forth and craft exceptional vertical navigation bars that leave a lasting impression on your users and contribute to the seamless navigation of your web content.

Leave a Reply