body { height:1200px; } .alert-box { display:table; width:100%; height:100%; position:fixed; top:0; bottom:0; left:0; right:0; z-index:9999; background:rgba(0,0,0,0.5); } .alert { text-align:center; display:table-cell; vertical-align:middle; } .alert input { width:200px; height:30px; line-height:30px; } b { font-size:30px; color:#FF8400; cursor:pointer; } button { cursor:pointer; }
使用css实现模态框的全屏幕覆盖以及居中显示