console
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=, initial-scale=">
<meta http-equiv="X-UA-Compatible" content="">
<title></title>
<style>
* {
margin: 0;
padding: 0;
}
.outter {
width: 800px;
border: 2px solid black;
overflow: hidden;
margin: 0 auto;
background-color: lightyellow;
}
#left {
width: 20%;
height: 500px;
float: left;
background-color: aliceblue;
}
.right {
width: 80%;
height: 500px;
float: left;
background-color: lightyellow;
}
#bar {
width: 30px;
height: 50px;
padding-left: 0px;
background-color: grey;
}
#handle {
width: 30px;
height: 50px;
}
</style>
</head>
<body>
<div class="outter">
<div style="display: block;" id="left">
<ol>
<li>菜单1</li>
<li>菜单2</li>
<li>菜单3</li>
<li>菜单4</li>
<li>菜单5</li>
</ol>
</div>
<div class="right" id="right">
<div id="bar">
<button id="handle" onclick="toggle('left')">隐藏</button>
</div>
</div>
</div>
<script>
function toggle(targetid) {
if (document.getElementById) {
target = document.getElementById(targetid);
if (target.style.display == "block") {
target.style.display = "none";
} else {
target.style.display = "block";
}
}
}
</script>
</body>
</html>