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的使用。

  • 相关阅读:
    窗体控件JFrame的使用
    WindowBuilder的安装与简介
    Swing事件机制
    Swing的MVC结构
    Swing框架的继承关系
    SWT简介
    Swing简介
    AWT简介
    Java界面设计
    使用Java建立聊天客户端
  • 原文地址:https://www.cnblogs.com/hanbingljw/p/3494838.html
Copyright © 2011-2022 走看看