zoukankan      html  css  js  c++  java
  • 仅用css制作的手风琴下拉菜单

    css制作手风琴下拉菜单:

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8"/>
        <title>html5 UI</title>
        <link rel="stylesheet" href="css/normalize.css"/>
        <!--[if lt IE 9]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    </head>
    <style>
          #box{ width:80%; margin: 15px auto; }
          article{
                   display: none;
                    width:100%;
                    height: 0;
                    border: 1px solid #cccccc;
                    box-shadow: 1px 2px 3px #cccc8f;
                    text-align: center;;
                    transition: all 0.2s ease;
                    -moz-transition:all 0.2s ease;
                   -webkit-transition: all 0.2s ease;
                   }
    
           input{ display: none; }
           label{ display: block;background-color: #b3d4fc;text-align: center;border: 1px solid #cccccc;cursor: pointer;}
          input#o:checked~.one{height: 55px; display: block; }
          input#t:checked~.two{height: 55px; display: block;}
          input#h:checked~.three{height: 55px; display: block;}
    </style>
    <body>
          <div id="box">
                  <section>
                      <input type="radio" checked id="o" name="item"/> <label for="o">first-item1</label>
                      <article class="one">this is item1 content!</article>
                      <input type="radio" id="t" name="item"><label for="t">second-item2</label>
                      <article class="two">this is item2 content!</article>
                      <input type="radio" id="h" name="item"><label for="h">three-item3</label>
                      <article class="three">this is item3 content!</article>
                  </section>
          </div>
    
    </body>
    </html>

     效果图:

    注释:关键是css的选择器使用和input:check的使用。

  • 相关阅读:
    Centos6.4 cobbler安装要点
    zabbix oracle监控插件orabbix部署安装
    CPP
    基于curl 的zabbix API调用
    oracle 存储过程
    sqlplus乱码
    Intent之对象传递(Parcelable传递对象和对象集合)
    IOS压缩解压缩
    深入浅出java静态代理和动态代理
    c语言用rand() 函数,实现random(int m)
  • 原文地址:https://www.cnblogs.com/hanbingljw/p/3494838.html
Copyright © 2011-2022 走看看