7.2.5 按钮式下拉菜单的大小
对于按钮式下拉菜单,同样可通过控制按钮大小的如下样式来控制其大小。
样式 |
描述 |
.btn-lg |
大按钮 |
.btn-sm |
小按钮 |
.btn-xs |
超小按钮 |
|
|
## 程序示例 ## |
|
如下代码示范了使用样式来控制按钮式下拉菜单的大小。 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
| <!DOCTYPE html> <html>
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <title> 下拉菜单 </title> <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="../bootstrap/css/bootstrap-theme.min.css"> </head>
<body> <div class="container"> <div class="btn-group"> <button class="btn btn-warning dropdown-toggle btn-lg" type="button" id="dropdown1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> 按钮式下拉菜单 <span class="caret"></span> </button> <ul class="dropdown-menu" aria-labelledby="dropdown1"> <li> <a href="#">新建</a> </li> <li> <a href="#">打开</a> </li> <li> <a href="#">保存</a> </li> <li role="separator" class="divider"></li> <li> <a href="#">退出</a> </li> </ul> </div> <div class="btn-group"> <button class="btn btn-warning dropdown-toggle" type="button" id="dropdown2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> 按钮式下拉菜单 <span class="caret"></span> </button> <ul class="dropdown-menu" aria-labelledby="dropdown2"> <li> <a href="#">新建</a> </li> <li> <a href="#">打开</a> </li> <li> <a href="#">保存</a> </li> <li role="separator" class="divider"></li> <li> <a href="#">退出</a> </li> </ul> </div> <div class="btn-group"> <button class="btn btn-warning dropdown-toggle btn-sm" type="button" id="dropdown3" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> 按钮式下拉菜单 <span class="caret"></span> </button> <ul class="dropdown-menu" aria-labelledby="dropdown3"> <li> <a href="#">新建</a> </li> <li> <a href="#">打开</a> </li> <li> <a href="#">保存</a> </li> <li role="separator" class="divider"></li> <li> <a href="#">退出</a> </li> </ul> </div> <div class="btn-group"> <button class="btn btn-warning dropdown-toggle btn-xs" type="button" id="dropdown4" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> 按钮式下拉菜单 <span class="caret"></span> </button> <ul class="dropdown-menu" aria-labelledby="dropdown4"> <li> <a href="#">新建</a> </li> <li> <a href="#">打开</a> </li> <li> <a href="#">保存</a> </li> <li role="separator" class="divider"></li> <li> <a href="#">退出</a> </li> </ul> </div> </div> <script type="text/javascript" src="../jquery-3.1.1.js"></script> <script type="text/javascript" src="../bootstrap/js/bootstrap.min.js"></script> </body>
</html>
|
|
|
原文链接: 7.2.5 按钮式下拉菜单的大小