Responsive Sidebar Menu using HTML & CSS | Side Navigation Menu

Responsive Sidebar Menu using HTML & CSS | Side Navigation Menu

Hello developers, today in this blog you’ll learn to create a Responsive Sidebar Menu or Side Navigation Menu using HTML & CSS.


Previously we have posted Responsive horizontal Menu bar using HTML, CSS & JavaScript, now it’s time to create a Responsive Sidebar Menu or Side Navigation Menu using HTML & CSS. 


The Sidebar consists of several menus which help the user to redirect to the various site within the webpage or may add features to the webpage. The Sidebar is an essential part of the web pages. The Sidebar menu may consist of Home, Dashboard, and Settings


In this blog (Responsive Sidebar Menu or Side Navigation Menu), the icons are placed on the left side, along with the logo at the top of the icons. The hover effect has been used in the sidebar. If you hover over the sidebar, the icons along with text will appear. Else the icons alone will be visible. The hover effect is also given to every icon button.


This page is made responsive by using media queries. When this page is viewed in mobile mode, the sidebar and the text size vary. 


The source code of this responsive Sidebar Menu or Side Navigation Menu is given below, you can copy the source code of this program. You can use this Responsive Sidebar Menu with your creativity and can take this form to the next level.


Responsive Sidebar Menu or Side Navigation Menu [Source Code]


To make this website (Responsive Sidebar Menu or Side Navigation Menu), you need to create two files: an HTML file & a CSS file.

First, create an HTML file with the name of index.html and remember, you have to create a file with a .html extension.

<!DOCTYPE html> <html> <head> <title></title> <link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/> </head> <body> <!-- Navbar --> <nav id="navbar"> <ul class="navbar-items flexbox-col"> <li class="navbar-logo flexbox-left"> <a class="navbar-item-inner flexbox"> <img src="https://cdn.pixabay.com/photo/2014/04/02/10/47/red-304573__340.png" width="50" height="50"> </a> </li> <li class="navbar-item flexbox-left"> <a class="navbar-item-inner flexbox-left"> <div class="navbar-item-inner-icon-wrapper flexbox"> <i class="fa fa-search"></i> </div> <span class="link-text">Search</span> </a> </li> <li class="navbar-item flexbox-left"> <a class="navbar-item-inner flexbox-left"> <div class="navbar-item-inner-icon-wrapper flexbox"> <i class="fa fa-home"></i> </div> <span class="link-text">Home</span> </a> </li> <li class="navbar-item flexbox-left"> <a class="navbar-item-inner flexbox-left"> <div class="navbar-item-inner-icon-wrapper flexbox"> <i class="fa fa-file"></i> </div> <span class="link-text">Projects</span> </a> </li> <li class="navbar-item flexbox-left"> <a class="navbar-item-inner flexbox-left"> <div class="navbar-item-inner-icon-wrapper flexbox"> <i class="fa fa-columns"></i> </div> <span class="link-text">Dashboard</span> </a> </li> <li class="navbar-item flexbox-left"> <a class="navbar-item-inner flexbox-left"> <div class="navbar-item-inner-icon-wrapper flexbox"> <i class="fa fa-users"></i> </div> <span class="link-text">Team</span> </a> </li> <li class="navbar-item flexbox-left"> <a class="navbar-item-inner flexbox-left"> <div class="navbar-item-inner-icon-wrapper flexbox"> <i class="fa fa-question-circle"></i> </div> <span class="link-text">Support</span> </a> </li> <li class="navbar-item flexbox-left"> <a class="navbar-item-inner flexbox-left"> <div class="navbar-item-inner-icon-wrapper flexbox"> <i class="fa fa-cog"></i> </div> <span class="link-text">Settings</span> </a> </li> </ul> </nav> <!-- Main --> <main id="main" class="flexbox-col"> <h2>Learningrobo</h2> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eum corporis, rerum doloremque iste sed voluptates omnis molestias molestiae animi recusandae labore sit amet delectus ad necessitatibus laudantium qui! Magni quisquam illum quaerat necessitatibus sint quibusdam perferendis! Aut ipsam cumque deleniti error perspiciatis iusto accusamus consequuntur assumenda. Obcaecati minima sed natus?</p> </main> </body> </html>

CSS provides style to an HTML page. To make the page attractive create a CSS file with the name style.css and remember that you have to create a file with a .css extension.

:root {
    --primary: 237, 94%, 81%;
    --background: 266, 16%, 92%;
    --background-secondary: 256, 12%, 12%;
    --background-secondary-dark: 256, 10%, 10%;
    --background-secondary-light: 257, 11%, 16%;
    --text-primary: 0, 0%, 0%;
    /* Colors */
    --black: 0, 0%, 0%;
    --white: 0, 0%, 100%;
    --quite-gray: 0, 0%, 50%;
    --grooble: 10, 28%, 93%;
    /* Sizes */
    --heading-medium: 3.6rem;
    --paragraph: 1.11rem;
    --navbar-buttons: 2.4rem;
    /* misc */
    --transition-main: .175, .685, .32;
    /* Fonts */
    --font-main: "Poppins";
}
*, *::before, *::after {
    box-sizing: inherit;
}
html, body {
    margin: 0;
    width: 100%;
    color: hsl(var(--text-primary));
    font-family: var(--font-main);
    background-color: #8BC6EC;
background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%);

    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
    box-sizing: border-box;
}
h2 {
    font-size: var(--heading-medium);
    font-weight: 900;
}
p {
    margin: 0;
    font-size: var(--paragraph);
}
/* Links */
a {
    color: hsla(var(--primary), 1);
    font-size: var(--paragraph);
    text-decoration: underline;
}
a:visited {
    color: hsla(var(--primary), .5);
}
.flexbox {
    display: flex;
    justify-content: center;
    align-items: center;
}
.flexbox-left {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}
.flexbox-col {
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
}
#navbar {
    top: 0;
    padding: 0;
    width: 5em;
    height: 100vh;
    position: fixed;
    background-color: hsl(var(--background-secondary));
    transition: width .35s cubic-bezier(var(--transition-main), 1);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

#navbar:hover {
    width: 16em;
    border-radius: 0 15px 15px 0;
}
.navbar-items {
    margin: 0;
    padding: 0;
    list-style-type: none;
}
/* Navbar Logo */
.navbar-logo {
    background: hsl(var(--background-secondary-dark));
}
.navbar-logo > .navbar-item-inner {
    width: calc(5rem - 8px);
}
.navbar-logo > .navbar-item-inner:hover {
    background-color: transparent;
}
/* Navbar Items */
.navbar-item {
    padding: 0 .5em;
    width: 100%;
    cursor: pointer;
}
.navbar-item-inner {
    padding: 1em 0;
    width: 100%;
    position: relative;
    color: hsl(var(--quite-gray));
    border-radius: .25em;
    text-decoration: none;
    transition: all .2s cubic-bezier(var(--transition-main), 1);
}
.navbar-item-inner:hover {
    color:black;
    background-color: #8BC6EC;
    background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%);
    box-shadow: 0 17px 30px -10px hsla(var(--black), .25);
}
.navbar-item-inner-icon-wrapper {
    width: calc(5rem - 1em - 8px);
    position: relative;
}
.navbar-item-inner-icon-wrapper ion-icon {
    position: absolute;
    font-size: calc(var(--navbar-buttons) - 1rem);
}
.link-text {
    margin: 0;
    width: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all .35s cubic-bezier(var(--transition-main), 1);
    overflow: hidden;
    opacity: 0;
}
#navbar:hover .link-text {
    width: calc(100% - calc(5rem - 8px));
    opacity: 1;
}
#main {
    margin: 0 0 0 5em;
    min-height: 150vh;
}
#main > h2 {
    width: 80%;
    max-width: 80%;
}
#main > p {
    width: 80%;
    max-width: 80%;
}
@media only screen and (max-width: 1660px) {
    :root {
        /* Sizes */
        --heading-medium: 3.4rem;
    }
}
@media only screen and (max-width: 1456px) {
    :root {
        /* Sizes */
        --heading-medium: 3.2rem;
    }     
}
@media only screen and (max-width: 1024px) {
    :root {
        /* Sizes */
        --heading-medium: 3rem;
    }
}
@media only screen and (max-width: 756px) {
    :root {
        /* Sizes */
        --heading-medium: 2.6rem;
        --paragraph: 1rem;
        --navbar-buttons: 2.2rem;
    }
}

We hope you would like this Responsive Sidebar Menu using HTML & CSS or Side Navigation Menu .

Thank you for reading our blog. If you face any problem in creating this Responsive Sidebar Menu using HTML & CSS or Side Navigation Menu , then contact us or comment us. We’ll try to provide a solution to your problem as soon as possible.


Thank you
Learning robo team

Post a Comment

Thank you
Learning robo team

Post a Comment (0)

Previous Post Next Post
Learning Robo says...
code copied
Welcome