Here you will learn how to create Sidebar Menu using Only HTML and CSS. I have created many more sidebar menus but in that case, I have used JavaScript code to make it work. In this case, I did not use any JavaScript or external library.
I have designed the menu on this site using pure HTML and CSS code. Normally it is completely hidden and a small button is found on the home page. When you click on that button, we see the full sidebar menu.
In this case, I have used the profile image to complete it. I also used icons with each menu item.
In this case, instead of JavaScript, I have implemented this HTML sidebar menu using the checkbox function of HTML code. As I said under normal conditions only we can see a small button. When you click on that button, the full sidebar will appear. This sidebar has a small cancel button which, when clicked, will completely hide the menu bar again.
Video Tutorial of Side Navigation Menu
If you do not understand what I am saying then you can watch the video tutorial below. The video below will help you learn how it works and how I made it.
First of all, I used a profile image in this design. Below that, I have a place to give the title. I have used background: # 020a0ee1 in this header section.
Here I have used many menu items. I have used an icon with each menu item which adds a lot to the beauty of this CSS sidebar. Below all, I have used 4 social media buttons here. I have used the hover effect on the link here. When you click on those items, those menu links will move a little to the right.
Sidebar Menu using Only HTML and CSS
I have tried to explain to you step by step the complete tutorial on making it. Also, if you want to download this required source code, use the download button at the bottom of the article.
Step 1: Create the basic structure of the sidebar
First of all, we have created the basic structure of the sidebar. In this case I have used the background: # 020a0ee1 of the menu bar and its width: 250px. If you want to change its background color then you can use any other background color instead of the color I used here.
Step 2: Add profile images and titles
In the header section, I have a profile image and a text Used. I have used the height and height of this image as 120px. In this case, you must use a rectangular image. Border-radius: 50% is used to round the image.
The text used in this case is font-size: 22px and padding: 15px. The padding helped to create some space around it.
Step 3: Add menu items to the sidebar
Above we have created a header section and now we will add the necessary menu items. Since I have used icons in this case, you must add a font awesome CDN link to your HTML file which will help to make these icons work.
Step 4: Design menu items with CSS
We will design the links added above using CSS code. Font-size: 18px and line-height: 65px have been used for each item. Padding-left: 40px has been used to keep these menu items slightly apart.
The color white has been used and a border has been used below each menu item and one at a time. I used margin-right: 16px between the icons to keep some distance between the icons and the menu items.
If you have seen the demo, you will understand that I have added a hover effect here. When you click on the menu items, a blue border appears on the left. For this I used border-left: 10px solid rgb (50, 200, 238).
Step 5: Create social buttons
Below, I have added four social media icons. Here I have added links from Facebook, YouTube, Twitter, and WhatsApp. You can use other icons if you want. Font-size: 20px and background: # 05071aa1 of those icons have been used.
padding: Added 10px to create some space. Margin-left: 16px is used to keep the icons away from each other. The hash effect has been used on the icons. When you click on the icons, the color of these icons changes and turns green.
Step 6: Create menus and cancel buttons
Now I have created the menu button and the cancel button using the check box. The menu button will help to show the sidebar completely and the Cancel button will help to hide it again.
Step 7: Design two buttons with CSS
I designed the buttons with the help of CSS below. In this case, I have used display: none to hide the checkbox. I used two buttons background: # 042331.
Now I have determined the position of those two buttons.
Step 8: Activate the sidebar
Now I have implemented those two buttons. First of all, here I used left: -250px to hide the sidebar. So far we have been able to see the sidebar completely but using this code it will be completely hidden.
Then I used the click function (check: checked ~) and here I used left zero. This means that when you click on the menu button, it will be left: 0. As a result, we will see the sidebar again.
Then I set the position after clicking Cancel and the menu button.
This is an easy and simple way to create sidebar menus. Earlier I made menu bars on many other types of sites. If you want you can see those designs. If you want the source code to create it, use the download button below.
Comments
Post a Comment
Ask Me Anything ........