参考:相关教程 js中的classList、toggle用法
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=<device-width>, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
html, body, div,span{
padding:0;
margin:0;
}
body{
position: relative;
}
#main{
height: 100%;
width: 100%;
background-color:burlywood;
}
h1, #header, #main_page{
/* width: 12