css sidebar menu

How we can create a sideout menu bar using pure CSS? Solution: CSS Sidebar Menu With Flexbox, Pure CSS Sidenav without JS.

Previously I have shared a dropdown navbar, now its time to create side navbar. Basically, sidenav is a sideout navigation menu which reveals from the left or right side. Nowadays most peoples prefer a sidebar menu because of its look very amazing and attractive.

Today you will learn to create a Pure CSS Sidenav bar without using JavaScript. There is a menu icon and some text on the webpage, but when you will click on the menu icon then side navbar will appear from the left. When the menu will appear, then the other contents will be slide and shift from the left side.

So, Today I am sharing CSS Sidebar Menu With Flexbox. I have created the program using some advance CSS method, I think the codes can help beginners to know CSS in depth. You can use this program on your website or project after a few changes.  Also, you can redesign to take this sidebar menu on next level.

If are you thinking now how this side nav menubar actually is, then see the preview given below.

Preview Of Pure CSS Sidenav

See this video preview to getting an idea of how this side menu looks like.

LIVE DEMO

Now you can see this visually, here also a live demo click on the button above to see the demo. If you like this, then get the source code of its.

You May Also Like:

CSS Sidebar Menu With Flexbox Source Code

Before sharing source code, let’s talk about it. First, I have created a div with the class name ‘container‘ and placed all the elements inside it. For the menu and close icons, I have created a checkbox input first then create two labels for two icons. There has a big part of HTML Data-* attribute for storing custom data.

Check out how I have stored custom data for input and label: <input data-function="swipe" id="swipe" type="checkbox"> <label data-function="swipe" for="swipe"> . After that I have created another div for the heading and texts. The menu based on HTML list type <li> tag, placed the list inside a div.

Now in the CSS file, first gave 0% width in the lists. Then put a condition when checkbox will checked then the sidebar width will 280px; and other content slide 280px to the right side. And for the icons change, first gave display:none; value to the cross icon, then put another condition when input checked then it will display and hide another icon. Selected the icons using CSS :nth-child() (info) property.

There are left many other basic properties, I can’t explain all in writing. I am just talking about the main things. You will understand the whole concept easily after getting the codes. For creating the program you have to create only 2 files, one for HTML and one for CSS.

Follow the steps to creating this sidebar menu without any trouble.

index.html

Create an HTML file named ‘index.html‘ and put these codes given here below.

style.css

Now create a CSS file named ‘style.css‘ and put these codes given here.

That’s It. Now you have successfully created CSS Sidebar Menu With Flexbox, Pure CSS Sidenav Bar. If you have any doubt or question comment down below.

Thanks For Visiting, Keep Visiting.

LEAVE A REPLY

Please enter your comment!
Please enter your name here