Creating Drop Down Menu on click CSS

前端 未结 8 866
夕颜
夕颜 2020-11-28 13:48

I\'m required to build a menu with 5 options, upon clicking a certain one a new sub menu is to appear. I have absolutely no idea how to do this.

8条回答
  •  我在风中等你
    2020-11-28 14:23

    Of course I am late but:

    You can trigger a css click using a hack!!

    Work with an checkbox!!

    Sample:

          ul{
                display: none;
            }
            #checkbox{
                opacity: 0;
            }
            #checkbox:checked + ul {
                
                display: block;
            }
        

    You can use transitions to animate the show an hide effect :) This is just a very simple example!!

    Mention: this is a CSS3 hack if you need borwser support for old browsers this is not working.

提交回复
热议问题