【菜鸟学习笔记】bootstrap_分裂按钮下拉列表

本文展示了一个使用Bootstrap实现的下拉菜单示例代码,包括基本的下拉菜单及倒序显示的下拉菜单。通过HTML、CSS和JavaScript,演示了如何创建具有选择功能的按钮及响应式的下拉列表。
<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link href="css/bootstrap.min.css" rel="stylesheet">
        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
          <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="btn-group">
            <button type="button" class="btn btn-danger">请选择</button>
            <button type="button" class="btn btn-danger dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
                <span class="caret"/>
            </button>
            <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
                <li role="presentation"><a role="menuitem" tabindex="-1" href="#">1</a></li>
                <li role="presentation" class="divider"></li> 
                <li role="presentation"><a role="menuitem" tabindex="-1" href="#">2</a></li> 
            </ul> 
        </div>
        <br><br><br><br><br><br>
        <div class="btn-group dropup">
            <button type="button" class="btn btn-danger">请选择</button>
            <button type="button" class="btn btn-danger dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
                <span class="caret"/>
            </button>
            <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
                <li role="presentation"><a role="menuitem" tabindex="-1" href="#">1</a></li>
                <li role="presentation" class="divider"></li> 
                <li role="presentation"><a role="menuitem" tabindex="-1" href="#">1</a></li> 
            </ul> 
        </div>
        <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
    </body>
</html>

效果

以上仅为学习笔记~

转载于:https://www.cnblogs.com/clover-llm/p/6500768.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值