手风琴

简洁Bootstrap手风琴下拉列表美化效果

阿里云


这是一款简洁的 Bootstrap 手风琴下拉列表美化效果。该效果在原生 bootstrap Accordion 的基础上,通过 CSS 样式来对它进行美化,生成简洁时尚的手风琴下拉列表效果。

使用方法:

在页面中引入 bootstrap 相关文件和 FontAwesome 字体图标文件。

也想出现在这里?联系我们
创客主机
  1. <link href="css/bootstrap.min.css" rel="stylesheet">
  2. <link href="css/font-awesome.min.css" rel="stylesheet">

HTML 结构:

该 bootstrap 手风琴下拉列表的基本 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>Lorem ipsum dolor ...... </p>
  16.                         </div>
  17.                     </div>
  18.                 </div>
  19.  
  20.                 <div class="panel panel-default">
  21.                     <div class="panel-heading" role="tab" id="headingTwo">
  22.                         <h4 class="panel-title">
  23.                             <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
  24.                                 Section 2
  25.                             </a>
  26.                         </h4>
  27.                     </div>
  28.                     <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
  29.                         <div class="panel-body">
  30.                             <p>Lorem ipsum dolor ......</p>
  31.                         </div>
  32.                     </div>
  33.                 </div>
  34.  
  35.                 <div class="panel panel-default">
  36.                     <div class="panel-heading" role="tab" id="headingThree">
  37.                         <h4 class="panel-title">
  38.                             <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
  39.                                 Section 3
  40.                             </a>
  41.                         </h4>
  42.                     </div>
  43.                     <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
  44.                         <div class="panel-body">
  45.                             <p>Lorem ipsum dolor ......</p>
  46.                         </div>
  47.                     </div>
  48.                 </div>
  49.             </div>
  50.         </div>
  51.     </div>
  52. </div>

CSS 样式:

原生的 bootstrap 手风琴效果如下图:

经过美化后的 bootstrap 手风琴效果如下图:

该 bootstrap 手风琴下拉列表的美化 CSS 样式如下:

  1. a:hover,a:focus{
  2.     text-decoration: none;
  3.     outline: none;
  4. }
  5. #accordion .panel{
  6.     border: none;
  7.     border-top: 1px solid #e8e8e8;
  8.     box-shadow: none;
  9.     border-radius: 0;
  10.     margin: 0;
  11. }
  12. #accordion .panel:last-child{
  13.     border-bottom: 1px solid #e8e8e8;
  14. }
  15. #accordion .panel-heading{
  16.     padding: 0;
  17. }
  18. #accordion .panel-title a{
  19.     display: block;
  20.     font-size: 16px;
  21.     font-weight: bold;
  22.     line-height: 24px;
  23.     color: #635858;
  24.     background: #fff;
  25.     padding: 15px 20px 15px 47px;
  26.     position: relative;
  27.     transition: all 0.5s ease 0s;
  28. }
  29. #accordion .panel-title a:before{
  30.     content: "\f068";
  31.     font-family: 'FontAwesome';
  32.     display: block;
  33.     width: 30px;
  34.     height: 30px;
  35.     line-height: 32px;
  36.     border-radius: 50%;
  37.     background: #888bc2;
  38.     font-size: 14px;
  39.     color: #fff;
  40.     text-align: center;
  41.     position: absolute;
  42.     top: 25%;
  43.     left: 0;
  44.     transition: all 0.3s ease 0s;
  45. }
  46. #accordion .panel-title a.collapsed:before{
  47.     content: "\f067";
  48. }
  49. #accordion .panel-body{
  50.     font-size: 15px;
  51.     color: #635858;
  52.     line-height: 25px;
  53.     border: none;
  54.     padding: 14px 20px 14px 47px;
  55. }

简洁 Bootstrap 手风琴下拉列表美化效果

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

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

发表回复

热销模板

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

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