1,Bootstrap 模态框插件Bootbox垂直居中样式:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap </title>
<!--[if lt IE 9]>
<script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.js"></script>
<script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.js"></script>
<![endif]-->
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.js"></script>
<script src="https://cdn.bootcss.com/bootbox.js/4.4.0/bootbox.js"></script> <style>
/* 模态框居中样式 */
.bootbox-container {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1049;
overflow-y: auto;
} .bootbox-container:empty {
position: static;
} .modal {
display: table;
width: 600px;
height: 100%;
margin: 0 auto;
} .modal-dialog {
display: table-cell;
vertical-align: middle;
}
/* //模态框居中样式 */
</style>
<script>
$(function () {
/*设置bootbox*/
bootbox.setLocale("zh_CN");
bootbox.setDefaults({container: '.bootbox-container'}); /*使用bootbox*/
bootbox.dialog({message: '<img src="https://www.cnblogs.com/images/logo_small.gif"/>'}).width(155);
});
</script>
</head>
<body> <h1>Hello, world!</h1> <!--bootbox容器-->
<div class="bootbox-container"></div>
</body>
</html>

2,Bootstrap模态框Modal垂直居中样式:

<!DOCTYPE html>
<html lang="en"> <head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap </title>
<!--[if lt IE 9]>
<script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.js"></script>
<script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.js"></script>
<![endif]-->
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.js"></script>
<script src="https://cdn.bootcss.com/bootbox.js/4.4.0/bootbox.js"></script> <style>
/* 模态框居中样式 */
.modal {
display: table;
width: 600px;
height: 100%;
margin: 0 auto;
} .modal-dialog {
display: table-cell;
vertical-align: middle;
} /* //模态框居中样式 */
</style>
</head> <body> <h2>创建模态框(Modal)</h2>
<!-- 按钮触发模态框 -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">开始演示模态框</button>
<!-- 模态框(Modal) -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">模态框(Modal)标题</h4>
</div>
<div class="modal-body">
<p>在这里添加一些文本</p>
<p>在这里添加一些文本</p>
<p>在这里添加一些文本</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">提交更改</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div> </body> </html>

BootstrapBootbox居中的更多相关文章

  1. 关于textview显示特殊符号居中的问题

    话说这是2017年的第一篇博客,也是一篇技术博客.先从简单的一篇解决问题开始吧,千里之行,始于足下! ------------------------------------------------- ...

  2. 谈谈一些有趣的CSS题目(五)-- 单行居中,两行居左,超过两行省略

    开本系列,讨论一些有趣的 CSS 题目,抛开实用性而言,一些题目为了拓宽一下解决问题的思路,此外,涉及一些容易忽视的 CSS 细节. 解题不考虑兼容性,题目天马行空,想到什么说什么,如果解题中有你感觉 ...

  3. css居中div的几种常用方法

    在开发过程中,很多需求需要我们居中一个div,比如html文档流当中的一块div,比如弹出层内容部分这种脱离了文档流等.不同的情况有不同的居中方式,接下来就分享下一下几种常用的居中方式. 1.text ...

  4. 浏览器的兼容模式下的button中文字垂直方向不居中显示

    <button style="cursor:pointer;vertical-align: middle;" >删除</button> 这时候垂直不居中. ...

  5. 如何只用CSS做到完全居中

    我们都知道 margin:0 auto; 的样式能让元素水平居中,而 margin: auto; 却不能做到垂直居中--直到现在.但是,请注意!想让元素绝对居中,只需要声明元素高度,并且附加以下样式, ...

  6. CSS常见居中讨论

    先来一个常见的案例,把一张图片和下方文字进行居中: 首先处理左右居中,考虑到img是一个行内元素,下方的文字内容也是行内元素,因此直接用text-align即可: <style> .con ...

  7. 《Web开发中让盒子居中的几种方法》

    一.记录下几种盒子居中的方法: 1.0.margin固定宽高居中: 2.0.负margin居中: 3.0.绝对定位居中: 4.0.table-cell居中: 5.0.flex居中: 6.0.trans ...

  8. css实现一行文字居中,多行文字左对齐

    问题及场景: 当内容能一行显示在盒子内时,文字居中对齐. 当内容过多换行后显示在盒子内时,文字左对齐. 其实这种视觉上的需求还是蛮常见的.比如用于弹出提示框,当提示内容比较少时,内容居中显示在弹出框, ...

  9. js控制div滚动条,滚动滚动条使div中的元素可见并居中

    1.html代码如下 <div id="panel"> <div id="div1"></div> <div id=& ...

随机推荐

  1. JVM 堆和栈的区别

      栈内存:   程序在栈内存中运行   栈中存的是基本数据类型和堆中对象的引用   栈是运行时的单元   栈解决程序的运行问题,即程序如何执行,或者说如何处理数据   一个线程一个独立的线程栈   ...

  2. php投票练习

    一.题目要求:建立如下两个数据库,实现投票和%的统计结果: 二.具体编写方法: (1).建立数据库: 里面的蓝色背景的表格名称就是我们所需的表格! 表格内容如下: 表名:diaoyantimu 表名: ...

  3. Linux JDK+TOMCAT+MYSQL+redis 安装日志

    检查是否安装iptables #先检查是否安装了iptablesservice iptables status#安装iptablesyum install -y iptables#升级iptables ...

  4. JDK 安装过程

    1.首先是下载jdk:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 2.下载完 ...

  5. win8系统不小心禁用了管理员权限怎么解决

    第一步:查看系统有没有其他管理员账户 按win+x键,然后选择命令提示符 点击命令提示符打开窗口,输入net localgroup Administrators命令,然后回车 如上图,查看窗口中的&q ...

  6. MySQL之乱码问题解决详解

    今天在写一个项目的时候,在数据库中手动插入数据不会产生中文乱码,但是通过javaWeb却出现乱码,把提交表单和响应中的乱码问题解决后,还是乱码.所以我锁定一定是我的mysql数据库中出现了乱码的现象.

  7. JS中一些常用的内置对象

    在JS中,经常会遇到明明知道一个对象有某个属性或方法,可是又不知道怎么写的情况.下面,我就罗列了一些JS中常用的内置对象的属性和方法. Math对象: Math对象的作用是执行常见的算术任务. 首先M ...

  8. swift -- as / 扩展

    一.使用 可选链式 调用代替强制展开 //当声明一个属性时,将属性类型设置为可选类型: 好处: 当可选类型的属性被赋予初始值时,系统调用初始值;当可选类型属性没有赋予初始值时,系统只会调用失败;如果属 ...

  9. docker X509 证书错误的终极解决办法

    最近在做Docker相关的东西,发现只要一pull镜像,就出现如下的ERROR x509: certificate signed by unknown authority. 调查后发现,是公司IT把h ...

  10. Mac系统安装nginx+rtmp模块

    1.安装命令 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install) ...