预备知识:
HTML CSS:
position;opacity;z-index;margin......
JS:
document.getElementById('id1').classList.remove('hide');
document.getElementById('id1').classList.add('hide');
完整代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.c1{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #0f0f0f;
opacity: 0.5;
z-index: 9;
}
.c2{
width: 500px;
height: 400px;
background-color: #f9f9f9;
position: fixed;
left: 50%;
top: 50%;
margin-top