Hello developers, today in this blog, you'll learn to create a Responsive Vertical Menu Bar using HTML & CSS.
The Vertical sidebar consists of several menus that help users to redirect to the various site within the webpage or may add features to the webpage. The sidebar is an essential part of the webpage.
In this blog (Responsive Vertical Menu Bar) on the webpage, there is content at the center of the webpage with an arrow mark on the left side. When you click on the arrow, the slider with the menu will slide from the left side of the webpage containing the list of menus. If you again click on the array button, the menu slider slide towards the left and gets hid. When the menu list is visible, the arrow point towards the left side and, when the menu list is in hiding, the arrow points towards the right direction. This indicates that there are two icons used in this project as well as the checkbox used. There is a scrollbar on the webpage. This page is made responsive by using the CSS media query property. The user can see the overflowing content by scrolling the page. CSS flex properties have been used for the alignment of content and the menu bars.
The source code of this Responsive Vertical Menu Bar is given below, if you want the source code of this program, you can copy it. You can use this Responsive Vertical Menu Bar with your creativity and can take this project to the next level.
Responsive Vertical Menu Bar[Source Code]
To make this website, you would like to make 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.
@import url('https://fonts.googleapis.com/css2?family=Overlock:wght@400;700&display=swap');
*,*::after, *::before,body ,html{
margin: 0;
padding: 0;
}
body{
font-family: 'Overlock' , sans-serif;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
background: #11998e;
background: -webkit-linear-gradient(to right, #38ef7d, #11998e);
background: linear-gradient(to right, #38ef7d, #11998e);
height: 100vh;
width: 100%;
}
header{
width: 250px;
height: 100%;
}
.open-menu{
width: 10px;
height: 100%;
position: fixed;
left: 0;
top: 0;
background-color: #000;
}
.open-menu span{
width: 15px;
height: 60px;
padding: 0 2px;
position: fixed;
left: 0;
top: 45vh;
z-index: -2;
background-color: #000;
border-bottom-right-radius: 10px;
border-top-right-radius: 10px;
-webkit-transition: top 1s;
transition: top 1s;
}
.open-menu i{
color: #dfe3ee;
position: absolute;
left: 3px;
top: 22px;
}
.nav{
width: 300px;
height: 100vh;
position: fixed;
left: 0;
top: 0;
z-index: 4;
background-color: #000;
color: #38ef7d;
transition: cubic-bezier(0.85, 0.18, 0.36, 1) left 1s;
}
.close-menu span{
width: 15px;
height: 60px;
padding: 0 2px;
position: absolute;
right: 0;
top: 45vh;
background-color: #38ef7d;
border-bottom-left-radius: 10px;
border-top-left-radius: 10px;
-webkit-transition: top 1s;
transition: top 1s;
}
.nav span i{
color: #000;
position: absolute;
left: 3px;
top: 22px;
}
.nav h1{
text-align: center;
margin-top: 50px;
font-size: 40px;
}
input{
opacity: 0;
position: fixed;
top: 0;
z-index: 5;
margin-left: 269px;
width: 30px;
height: 100%;
-webkit-transition: margin-left .5s;
transition: margin-left .5s;
}
input:checked{
opacity: 0%;
margin-left: -10px;
width: 30px;
height: 100%;
-webkit-transition: margin-left .5s ease-in;
transition: margin-left .5s ease-in;
}
input:checked + nav{
left: -300px;
transition: all 1s cubic-bezier(1, 0.05, 0.25, 0.96);
}
input:checked ~ span{
background-color: rgb(255, 255, 255);
}
.menu-items{
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
line-height: 40px;
list-style-type: none;
margin-top: 40px;
}
.menu-item{
text-align: center;
width: 130px;
margin-top: 20px;
background-color: #38ef7d;
color:#000;
transition: background-color 3s;
border-radius: 10px;
}
.menu-item:hover{
background-color: #11998e;
transition: all .3s;
}
.menu-item:hover > a{
color: #000;
}
.menu-items a{
color: #000 ;
text-decoration: none;
transition: color s;
}
.container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
max-width: 85%;
position: relative;
}
.row {
width: 100%;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin-right: -15px;
margin-left: -15px;
}
.content{
padding: 50px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
width: 100%;
font-size: 20px;
}
@media only screen and (max-height:580px) {
nav{
overflow: auto;
z-index: 5;
}
.container{
padding-bottom: 40px;
}
::-webkit-scrollbar{
width: 12px;
}
::-webkit-scrollbar-track{
background-color: #3b4d7e;
}
::-webkit-scrollbar-thumb{
background-color:#3b4d7e;
}
}
::-webkit-scrollbar{
width: 12px;
}
::-webkit-scrollbar-track{
background-color: #f7f7f7;
}
::-webkit-scrollbar-thumb{
background-color: #8b9dc3;
}
.credit a{
text-decoration: none;
color: #fff;
font-weight: 800;
}
.credit {
font-family: Verdana, Geneva, Tahoma, sans-serif;
margin: 10px;
color:#000;
text-align: center;
}
Thank you for reading our blog. If you face any problem creating this Responsive Vertical Menu Bar using HTML & CSS, then contact us or comment us. We'll try to provide a solution to your problem as soon as possible.
Post a Comment
Thank you
Learning robo team