Please click on `open` and then click on `close`. The close is within `SLIDER` div but when the `width` of slider div is `0` the `close` text still appears.

```js
function openNav() {
  document.getElementById("main").style.marginLeft = "320px";
  document.getElementById("slider").style.width = "320px";
}

function closeNav() {
  document.getElementById("main").style.marginLeft = "0px";
  document.getElementById("slider").style.width = "0px";
}
```

```css
body {
  margin: 0;
  padding: 0;
  background: #f1f1f1
}
#main {
  margin-left: 0px;
  transition: all 0.5s
}
.header {
  width: 100%;
  min-width: 320px;
  height: 60px;
  background: #154760;
}
.slider {
  width: 0;
  height: 669px;
  background: #066;
  position: fixed;
  top: 0;
  left: 0;
  transition: all 0.5s;
  z-index: 1000;
  display: inline-block;
}
a {
  color: #fff
}
```

```html
<div class="slider" id="slider">
  <div style="width:inherit;display:inline-block"> <a href="JavaScript:void()" onclick="closeNav()" style="display:inline-block"> CLOSE</a> 
  </div>
</div>
<div id="main">
  <div class="header"> <a href="JavaScript:void()" onclick="openNav()" style="margin-left:50px"> OPEN</a>
  </div>
</div>
```