<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class="container">
<div class="dialog">abc</div>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
}
body {
background-color: yellow;
}
.container {
position: fixed;
top:0; right:0; bottom:0; left:0;
background-color: rgba(0,0,0,0.3);
text-align: center;
font-size: 0;
white-space: nowrap;
overflow: auto;
}
.container:after {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
.dialog {
display: inline-block;
vertical-align: middle;
text-align: left;
font-size: 14px;
white-space:normal;
border: 1px solid;
}