Bootstrap模态对话框用法简单示例

环境:bootstrap-3.3.5,jquery-3.0.0

代码:

<!DOCTYPE html> <html> <head> <title> bootstrap模态对话框</title> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <link href="https://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" /> <link href="https://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" /> <script src="https://cdn.bootcss.com/jquery/3.0.0/jquery.min.js" ></script> <script src="https://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js" ></script> </head> <body> <h2>创建模态框(Modal)</h2> <!-- 按钮触发模态框 --> <button data-toggle="modal" data-target="#myModal"> 开始演示模态框 </button> <!-- 模态框(Modal) --> <div tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div> <div> <div> <button type="button" data-dismiss="modal" aria-hidden="true"> × </button> <h4> 模态框(Modal)标题 </h4> </div> <div> 在这里添加一些文本 </div> <div> <button type="button" data-dismiss="modal">关闭 </button> <button type="button"> 提交更改 </button> </div> </div><!-- /.modal-content --> </div><!-- /.modal --> </div> </body> </html>

小编已经将代码中所引用的bootstrap相关css、js文件全部换成了cdn形式,方便测试。

这里使用在线HTML/CSS/JavaScript代码运行工具测试,可得到如下显示效果:

Bootstrap模态对话框用法简单示例

PS:关于bootstrap布局,这里再为大家推荐一款本站的在线可视化布局工具供大家参考使用:

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

转载注明出处:http://www.heiqu.com/86b354a5b4b591a8b00affaf25c58b8d.html