My whole question is in the title.

I have side menu which is shown when yellow button clicked. But when sidebar appears the button goes behind it. I need it on the top so that user could click it and close the sidebar. Html markup is complex, so serious changings of markup are not preferable.

I need to put yellow button div on the very top, not the header, header should be behind the sidebar. How to do that? Tried many things, but nothing helped...

<div class="header">
  <div>
    <div class="button">
      close
    </div>
  </div>
</div>
<div class="sidebar">
  fasdf
</div>

.header {
  height: 60px;
  background-color: green;
  top: 0;
  left: 0;
  position: fixed;
  width: 100%;
}
.button {
  height: 60px;
  background-color: yellow;
  width: 60px;
  z-index: 100;
  flex: 1;
}
.sidebar {
  height: 100%;
  width: 100px;
  background-color: pink;
  position: fixed;
  top: 0;
  left: 0;
  flex: 1;
  z-index: 1;
  opacity: .9;
}

https://jsfiddle.net/epwx4s79/4/

0 Answers