转载请注明出处http://blog.csdn.net/q498003692/article/details/52262968
注:当然这说的兼容不包括rgba
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.dialog {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .6);
text-align: center;
}
.dialog:before {
content: '';
width: 0;
height: 100%;
display: inline-block;
vertical-align: middle;
}
.dialog-inside {
display: inline-block;
vertical-align: middle;
width: 300px;
height: 300px;
background: #fff;
}
</style>
</head>
<body>
<div class="dialog">
<div class="dialog-inside">content</div>
</div>
</body>
</html>