css expandable menu on click

How we can create an expandable menu using HTML & CSS? Solution: CSS Expandable Menu On Click, Pure CSS Expanding Menu Button.

Maybe you have seen menus with an expandable feature. In my opinion, they are very attractive and unique. I have seen these types of the menu bar on some websites. Most people who focus on create a beautiful UI, they use these types of unique things.

Now question is that how we can create a menu with an expandable feature on click. Well, we can create this using only HTML & CSS. The concept is very easy, but you must have coding logic.  If you don’t have good logic in coding, then you can’t create new things also after knowledge of coding.

So, Today I am sharing CSS Expandable Menu On Click. In other words, Menu Expands On Button Click. This menu is built-in Pure CSS & HTML, I did not use JavaScript or other libraries. You don’t believe, this menu is based on HTML checkbox and lists. Process and codes to creating it is very easy and understandable.

If you are thinking now how this menu actually is, Then see the preview given below.

Preview Of Expanding Menubar On Button Click

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

Now you can see this visually. If you like this, then get the source code of its.

You May Also Like:

CSS Expandable Menu On Click Source Code

Before sharing source code, let’s talk about it. First, I created a checkbox using <input type="checkbox"> for creating the button. I converted the checkbox to circle using border-radius: 50%; (get info).  I created 3 spans to creating the menu icon, I did not use any external icon pack because this is a pure CSS concept.

After that, I created a div and put a list of menus inside it using <li>.  After clicking on button, the button expands to 500px & the menu list appears because I put absolute position list div. I created the close icon using CSS rotate property, I hide a span using display: none and rotated other two spans in 45 degrees and -45 degrees.

Left other things you will understand after getting the codes.  For creating this menu you have to create only 3 files, one for HTML & one for CSS. Follow the steps to creating this without any error.

index.html

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

style.css

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

That’s It. Now you have successfully created CSS Expandable Menu On Click. In other words, Menu expands from a button on click. If you have any doubt or question comment down below.

Thanks For Sharing, Keep Sharing.

10 COMMENTS

  1. Brother where are you learning this from? Can you please tell? Or are you afraid that somebody will steal your show?

    • Bro I have joined many developer & designers group on facebook, Most peoples ask for how to create this & this? Then I got a new idea about daily posts. Also, I am doing a part-time job, every day I face a new problem, from there I also get ideas.

  2. This is really great but I’ve seen one of your codes in a YouTube channel. Thought you might know. Or maybe it’s just a coincidence.

  3. First of, very fine work. Fast and easy to use.

    I’ve got a tiny problem thoe… it seems the code does not support Safari? Cant seem to find any flaws in it, perhaps you’ve got a suggestion?

LEAVE A REPLY

Please enter your comment!
Please enter your name here