css nested list drop down

How we can create an HTML nested list with sublist interface using CSS? Solution: Check out this CSS Nested List Drop Down With Sub List, Clickable List Options.

Previously I have shared Dropdown Select Option List, But this is little different from that. Basically, this is a type of mobile’s options list, when we click on any option and other option will appear inside that which option we have selected. Nowadays these type lists use to create small web apps or cross platforms.

Today you will learn to create clickable list options with sub-lists. This is kind of category selection with HTML lists, there are some list and their sub-lists when you will click on any list item then its sub-list will visible. I think this program will very useful for your website or project. And this is a very easy concept based on a library, you will understand easily.

So, Today I am sharing CSS Nested List Drop Down With Sub List. This program is based on a CSS library because libraries make work more easy. Also, here JavaScript handling an important thing, which is show and hides sub lists. All the lists are based on simple HTML list tags. You can use this as a category filter or selector.

If you are thinking now how this clickable list options actually are, then see the preview given below.

Preview Of Clickable List Options With Sub Lists

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

Live Demo

Now you can see this visually, you also can see it live by pressing the button given above. If you like this, then get the source code of its.

You May Also Like:

CSS Nested List Drop Down With Sub List Source Code

Before sharing source code, let’s talk about it. First I have created two sections, one for put heading or title and another for list and sub-lists. For creating this program I have used a CSS framework which is Bulma, it is based on flexbox. For creating a nested list I have used HTML <ul> and <li>  tags.

Now using CSS I have given values of height, width, margin, padding, color, etc. There I have used a framework that’s why there are fewer CSS codes. And JavaScript handling a great feature which is show and hiding items. There is a toggle feature based on JavaScript, using that you can hide show items by single or multiple clicks.

Left all other things you will understand after getting the codes, I can’t explain all in writing. For creating this program you have to create 3 files. First for HTML, second for CSS and third for JavaScript. Follow the steps to creating this without any error.

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.

function.js

The final step, Create a JavaScript file named ‘function.js‘ and put the codes.

That’s It. Now you have successfully created CSS Nested List Drop Down With Sub List, Clickable List Options. If you have any doubt or question comment down below.

Thanks For Visiting, Keep Visiting.

2 COMMENTS

  1. Hi,

    This effect is not working in IE. Can you resolve this issue and provide the code, which is supporting all browser.

    Thanks,
    Vikas Gupta

  2. Hi, great job, working perfectly. I am trying to re-use the structure but wanted to ask where i need to change the CSS to have all the main options staying (graphic design, web design, web development, etc.) and not disappearing when you open one of them and the subsections are displayed. Could you please help?
    Thanks, 🙂
    Kate

LEAVE A REPLY

Please enter your comment!
Please enter your name here