直接上代码!详细讲解在注释里
<!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.0">
<title>点击按钮弹出提示框 半透明黑色背景</title>
<style>
/* 加入样式 */
#black {
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index: 1001;
-moz-opacity: 0.8;
opacity: .50;
filter: alpha(opacity=88);
}
#show{
display: none;
position: absolute;
top: 20%;
left: 37%;
width: 528px;