bootstrap入门【模态框】

本文介绍了一种模态对话框的实现方式,并提供了基于Bootstrap框架的HTML代码示例。模态对话框是一种阻止用户与应用其他部分交互直至对话框关闭的UI元素。本文通过实例展示了如何设置模态对话框的基本结构,包括头部、主体和底部。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


模态对话框(Modal Dialogue Box,又叫做模式对话框),是指在用户想要对对话框以外的应用程序进行操作时,必须首先对该对话框进行响应。如单击【确定】或【取消】按钮等将该对话框关闭。


用起来还是有些复杂,仍然是分为头部,身体,脚部三个部分,添加了很多标签。


<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link href="bootstrap.min.css" rel="stylesheet">
    <script src="jquery-2.1.3.min.js"></script>
    <script src="bootstrap.min.js"></script>
</head>
<body>
    <div class="modal" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="myModalLable" aria-hidden="true">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close" >
                    <span aria-hidden="true">×</span>
                </button>
                <h4 class="modal-title" id="mymodallabel">modal title</h4>
            </div>
            <div class="modal-body">
                content
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">close</button>
                <button type="button" class="btn btn-primary" data-dismiss="modal">save</button>
            </div>
        </div>
    </div>
    <script>
        $("#mymodal").modal("show");
    </script>
</body>
</html>




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值