Bootstrap CSS组件之下拉菜单(dropdown)

Bootstrap下拉菜单,常用在开发项目中,今天为大家介绍介绍

dropdown、dropdown-menu、dropdown-header、divider、dropdown-submenu
例子见下拉菜单.html

//源码 .dropup, .dropdown { position: relative; } .dropdown-toggle:focus { outline: 0; } .dropdown-menu { position: absolute; top: 100%; left: 0; z-index: 1000; display: none; float: left; min-width: 160px; padding: 5px 0; margin: 2px 0 0; font-size: 14px; text-align: left; list-style: none; background-color: #fff; -webkit-background-clip: padding-box; background-clip: padding-box; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, .15); border-radius: 4px; -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175); box-shadow: 0 6px 12px rgba(0, 0, 0, .175); } .dropdown-menu.pull-right { right: 0; left: auto; } .dropdown-menu .divider { height: 1px; margin: 9px 0; overflow: hidden; background-color: #e5e5e5; } .dropdown-header { display: block; padding: 3px 20px; font-size: 12px; line-height: 1.42857143; color: #777; white-space: nowrap; }

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- Bootstrap从3.0版本开始全面支持移动平台,贯彻移动先行宗旨 --> <meta content="width=device-width, initial-scale=1"> <title>Bootstrap 101 Template</title> <!-- Bootstrap --> <link href="https://www.jb51.net/bootstrap-3.3.7-dist/css/bootstrap.min.css"> </head> <body> <!-- --> <div> <button type="button" data-toggle="dropdown"> 我的书籍<span></span> </button> <ul> <li><a href="#">编程</a></li> <li><a href="#">设计</a></li> <li><a href="#">深入</a></li> </ul> </div> <!-- dropdown/dropdown-menu/dropdown-header --> <div> <button type="button" data-toggle="dropdown"> 我的书籍<span></span> </button> <ul> <li>前端</a></li> <li><a href="#">JS</a></li> <li><a href="#">HTML</a></li> <li><a href="#">CSS</a></li> <li></li> <li>后台</li> <li><a href="#">PYTHON</a></li> <li><a href="#">JAVA</a></li> </ul> </div> <!-- bootstrap是基于jQuery--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://www.jb51.net/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script> </body> </html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwfwjs.html