Simple Sidebar Menu Using HTML, CSS & JavaScript
From this tutorial, you will learn how to create simple sidebar menus using HTML CSS, and JavaScript. Currently, the HTML sidebar menu is an important web element that is often used in the case of websites.
Although navigation bars can be found on most websites. However, at the present time, both the navigation bar and the responsive sidebar menu are kept in the sites that are being created.
Earlier I shared many more sidebar HTML CSS designs. They are very advanced but this design is very simple.
Simple Sidebar Menu HTML CSS
If you know basic Html and CSS then you can easily create this CSS sidebar navigation menu. Some HTML, CSS and just 2 lines of JavaScript have been used to create this sidebar Html CSS template. Earlier I created a drop-down sidebar menu. But I used some jquery in it.
There are many types of side menubars. In some cases, this menu bar appears to be in a completely fixed state while in others it is in the form of a pop-up.
We do not see the menu bar in popup format. A small button is found instead. In the responsive sidebar menu, I have given some menu items and there is a cancel button.
See the Pen Hamburger Menu by Shantanu Jana (@shantanu-jana) on CodePen.
Let me tell you something about how this HTML sidebar menu will work. First I created a basic structure of this sidebar whose width: 25rem and then using left: -25rem I moved it to 25rem on the left side.
Related Post:
1. Menu bar With Tooltip in CSS
2. Responsive Top Navigation Menu Bar
3. CSS Tab Bar with Animation
4. Sidebar Menu Using HTML, CSS
5. Vertical Navigation Menu Using HTML
4. Sidebar Menu Using HTML, CSS
4. Sidebar Menu Using HTML, CSS
As a result, we will not be able to see that simple side menu Html. There is a menu button which when clicked will be left: 0 which means we will see the whole sidebar again.
How to Create a Responsive Sidebar Menu in HTML CSS
Now let's learn how to create a simple sidebar Html CSS. Here I have shared a step-by-step tutorial. However, if you want, you can download all the necessary source code by clicking the button below the article.
1. The basic structure of the sidebar
First, you need to create a basic structure for the sidebar. As you can see in the demo above. We will add all the information in this area.
Now the basic structure of the sidebar has been designed using CSS. Here the width: 25rem and height: 100vh of the sidebar have been used.
Above we can see the width of the basic structure of this site bar: 25rem. But now it has to be completely hidden.
To hide this, we move the sidebar to the left as wide as possible. As a result, the sidebar will not be visible in normal conditions.
2. Menu button to open CSS Sidebar
Now you need to create a toggle button or menu button. We need to use three lines to create this toggle.
The menu button is designed with the following CSS. I have used the width: 4rem, height: 3.5rem, and position: fixed of this button. As a result of using position: fixed, the toggle button can be seen even if the sidebar is completely hidden.
The sidebar navigation menu button is made up of 3 lines. The following CSS has been used to design those lines. I have used the height of the lines: 4px and white as the background color.
When you click on the menu button, you need to determine what these lines and buttons will change. When you click on the menu button, the first and third lines join together at 45 degrees to form a cross mark. And the middle line will be hidden.
3. Add menu item in Simple Sidebar
Now we will add the menu items to this CSS sidebar navigation bar. Here I will basically add five menus to it. Then I will design them with CSS.
Now using CSS before I have added a hover color effect here. When you hover your mouse over those menu items, one underline text will be attached.
4. Activate the CSS Sidebar Menu
Now it's time to activate the Simple Sidebar Menu using JavaScript. I have added some information in the '.toggle' above.
Now JavaScript has to add that information to the menu button. I have instructed her that when you click on that toggle button, the sidebar will be left: 0, and you will see the sidebar.
HTML sidebar menu can be created in different ways. In many cases, Advance has some features and in some cases has a simple structure. Earlier I showed many more advice designs that included profile images, social media icons, and dropdowns.
Hopefully from this article, you have learned how to create a simple sidebar menu. If there is any problem then you can definitely comment.
Comments
Post a Comment
Tell me what you think ??😎