手风琴

超酷CSS3垂直手风琴列表

阿里云


这是一款基于 Bootstap 的超酷 CSS3 垂直手风琴列表效果。该 CSS3 垂直手风琴列表在元素 Bootstap 的基础上,添加了自定义的样式,使手风琴的效果更加好看。

使用方法:

在页面中引入 jquery 和 bootstrap 相关文件,以及 font-awesome 字体图标文件。

也想出现在这里?联系我们
创客主机
  1. <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
  2. <link href="http://cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
  3. <script src="http://cdn.bootcss.com/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>
  4. <script src="http://cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

HTML 结构:

该垂直手风琴列表的 HTML 结构如下:

  1. <div class="container">
  2.     <div class="row">
  3.         <div class="col-md-6">
  4.             <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
  5.                 <div class="panel panel-default">
  6.                     <div class="panel-heading" role="tab" id="headingOne">
  7.                         <h4 class="panel-title">
  8.                             <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
  9.                                 Section 1
  10.                             </a>
  11.                         </h4>
  12.                     </div>
  13.                     <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
  14.                         <div class="panel-body">
  15.                             <p>...</p>
  16.                         </div>
  17.                     </div>
  18.                 </div>
  19.                 <div class="panel panel-default">
  20.                     <div class="panel-heading" role="tab" id="headingTwo">
  21.                         <h4 class="panel-title">
  22.                             <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
  23.                                 Section 2
  24.                             </a>
  25.                         </h4>
  26.                     </div>
  27.                     <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
  28.                         <div class="panel-body">
  29.                             <p>... </p>
  30.                         </div>
  31.                     </div>
  32.                 </div>
  33.                 <div class="panel panel-default">
  34.                     <div class="panel-heading" role="tab" id="headingThree">
  35.                         <h4 class="panel-title">
  36.                             <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
  37.                                 Section 3
  38.                             </a>
  39.                         </h4>
  40.                     </div>
  41.                     <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
  42.                         <div class="panel-body">
  43.                             <p>... </p>
  44.                         </div>
  45.                     </div>
  46.                 </div>
  47.             </div>
  48.         </div>
  49.     </div>
  50. </div>

HTML 结构:

为该垂直手风琴列表添加如下的 CSS 样式:

  1. a:hover,a:focus{
  2.     text-decoration: none;
  3.     outline: none;
  4. }
  5. #accordion{
  6.     padding-left: 76px;
  7.     overflow: hidden;
  8.     position: relative;
  9.     z-index: 1;
  10. }
  11. #accordion:before{
  12.     content: "";
  13.     width: 1px;
  14.     height: 90%;
  15.     background: #9d325b;
  16.     position: absolute;
  17.     top: 0;
  18.     left: 22px;
  19.     z-index: -1;
  20. }
  21. #accordion .panel{
  22.     border: none;
  23.     box-shadow: none;
  24.     border-radius: 0;
  25. }
  26. #accordion .panel-heading{
  27.     padding: 0;
  28.     border-radius: 0;
  29.     border: none;
  30. }
  31. #accordion .panel-title a{
  32.     display: block;
  33.     font-size: 16px;
  34.     font-weight: bold;
  35.     color: #31162e;
  36.     padding: 10px 30px 15px 0;
  37.     background: #fff;
  38.     position: relative;
  39.     transition: all 0.5s ease 0s;
  40. }
  41. #accordion .panel-title a:before{
  42.     content: "\f05b";
  43.     font-family: fontawesome;
  44.     font-size: 20px;
  45.     color: #fff;
  46.     width: 40px;
  47.     height: 40px;
  48.     line-height: 40px;
  49.     text-align: center;
  50.     background: #9d325b;
  51.     border: 1px solid #9d325b;
  52.     position: absolute;
  53.     top: 0;
  54.     left: -74px;
  55. }
  56. #accordion .panel-title a.collapsed:before{
  57.     color: #9c335b;
  58.     background: #fff;
  59. }
  60. #accordion .panel-body{
  61.     font-size: 14px;
  62.     color: #487677;
  63.     line-height: 25px;
  64.     padding: 5px 15px 15px 0;
  65.     border: none;
  66. }

超酷 CSS3 垂直手风琴列表

已有 475 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!