title: html element on top of header but behind main section, tried to correct using z-index but did not work
body: <p>so i have designed a nav element where on a mobile device, you click a button (the 3 menu bar hamburger) and the nav element slides in from the left. on the original index page it appears on top of the header which is what i want, i didnt even have to use z-index to achieve this. so i created a login page with a form element and two inputs. i havent optimised the form element for mobile but i was having a look and althoughthe nav appears above the header, it appears underneath or behind the form. i tried correcting this by setting the z-index to 0 and 1 respectively but it didnt correct it. </p>
  
  <p>i have a header in an includes file... here</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;meta http-equiv="X-UA-compatible" content="IE=edge"&gt;
      &lt;link rel="stylesheet" href="css/head.css"&gt;
      &lt;link rel="stylesheet" href="css/foot.css"&gt;
      &lt;link rel="stylesheet" href="css/login.css"&gt;
  
      &lt;title&gt;Pratts of carlow &lt;/title&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
  
      &lt;header&gt;
          &lt;h1&gt; Pratts of Carlow &lt;/h1&gt;
  
          &lt;div id="menubar"&gt;
            &lt;div class="bar"&gt;
            &lt;/div&gt;
            &lt;div id="dos" class="bar"&gt;
            &lt;/div&gt;
            &lt;div class="bar"&gt;
            &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div id="logos"&gt;
            &lt;img src="images/fiat.png" alt="fiat logo"&gt;
            &lt;img src="images/fiatpro.png" alt="fiat pro logo"&gt;
          &lt;/div&gt;
      &lt;/header&gt;
  
      &lt;nav id="slidenav"&gt;
        &lt;a href="#" id="exit"&gt; x &lt;/a&gt;
        &lt;ul&gt;
          &lt;li&gt;&lt;a href="#"&gt;HOME&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#"&gt;ABOUT US&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#"&gt;SALES&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#"&gt;SERVICE&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#"&gt;PARTS&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#"&gt;CONTACT&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#"&gt;LOGIN&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/nav&gt;
  </code></pre>
  
  <p>here is the corresponding css for the header</p>
  
  <pre><code>            /* ****************************************************************************/
          /* CSS RESET */
          /* ****************************************************************************/
  
          html, body, div, span, applet, object, iframe,
          h1, h2, h3, h4, h5, h6, p, blockquote, pre,
          a, abbr, acronym, address, big, cite, code,
          del, dfn, em, img, ins, kbd, q, s, samp,
          small, strike, strong, sub, sup, tt, var,
          b, u, i, center,
          dl, dt, dd, ol, ul, li,
          fieldset, form, label, legend,
          table, caption, tbody, tfoot, thead, tr, th, td,
          article, aside, canvas, details, embed,
          figure, figcaption, footer, header, hgroup,
          menu, nav, output, ruby, section, summary,
          time, mark, audio, video {
              margin: 0;
              padding: 0;
              border: 0;
              font-size: 100%;
              font: inherit;
              vertical-align: baseline;
          }
          /* HTML5 display-role reset for older browsers */
          article, aside, details, figcaption, figure,
          footer, header, hgroup, menu, nav, section {
              display: block;
          }
          body {
              line-height: 1;
          }
          ol, ul {
              list-style: none;
          }
          blockquote, q {
              quotes: none;
          }
          blockquote:before, blockquote:after,
          q:before, q:after {
              content: '';
              content: none;
          }
          table {
              border-collapse: collapse;
              border-spacing: 0;
          }
  
          /******************************************************************************/
          /******************************************************************************/
  
          body {
            position: relative;
            margin: 0 auto;
            width: 100%;
              height: 100%;
          }
  
          header {
            position: relative;
            display: flex;
            flex-flow: row nowrap;
            justify-content: space-between;
            align-items: center;
            margin: 0 auto;
            width: 100%;
            height: 100px;
            background-color: rgb(170,10,50);
            border-bottom: 2px solid rgb(180,20,60);
          }
  
          header h1 {
            position: relative;
            font-family: helvetica;
            font-size: 30px;
            width: 200px;
            padding: 10px;
            letter-spacing: 2px;
            color: white;
            font-weight: bold;
          }
  
          #menubar {
            position: absolute;
            width: 40px;
            height: 20px;
            top: 34px;
            right: 25px;
          }
  
          .bar {
            position: relative;
            width: 40px;
            height: 5px;
            background-color: white;
            border-radius: 3px;
          }
  
          #menubar:hover &gt; .bar {
            background-color: rgb(180,180,180);
          }
  
          #dos {
            margin: 3px 0px 3px 0px;
          }
  
          nav {
            position: absolute;
            left: -150px;
            top: 0px;
            height: 100%;
            width: 80%;
            max-width: 150px;
            text-align: center;
            background-color: white;
            border-right: 1px solid grey;
            transition: left .5s ease-out;
              z-index: 1;
          }
  
          #exit {
            position: reltive;
            float: right;
            color: grey;
          }
  
          ul {
            position: relative;
            text-align: center;
            clear: both;
          }
  
          nav ul li {
            border-top: 1px solid grey;
            padding: 15px 0px 15px 0px;
          }
  
          nav ul li:hover {
            background-color: rgb(240,240,240);
  
          }
  
          nav a {
            text-decoration: none;
            font-family: helvetica;
            font-size: 10px;
            margin: 10px;
            color: grey;
          }
  
          #logos{
            display: none
          }
  
          /******************************************************************************/
          /******************************************************************************/
  
          @media screen and (min-width: 680px){
            #menubar {display: none;}
            #exit{display: none;}
  
            nav {
              position: relative;
              margin: 0 auto;
              left: 0px;
              width: 100%;
              min-width: 550px;
              max-width: 1200px;
              height: 25px;
              border: none;
            }
  
            nav ul {
              display: flex;
              flex-flow: row nowrap;
              justify-content: space-between;
              width: 100%;
            }
  
            nav ul li {
              display: inline-block;
              margin: 0 auto;
              border: none;
              margin: 0 auto;
              padding: 4px;
            }
  
            nav ul li:hover {
              background-color: white;
            }
  
            nav ul li a:hover {
              color: rgb(100,100,100);
            }
  
            #logos {
              display: flex;
              flex-flow: row nowrap;
              justify-content: space-around;;
              height: 76px;
              width: 200px;
            }
  
            #logos img {
              max-width: 76px;
            }
          }
  </code></pre>
  
  <p>the footer</p>
  
  <pre><code>    &lt;footer&gt;
          &lt;blockquote&gt;
            &lt;h2&gt;ADDRESS&lt;/h2&gt; &lt;br&gt;
            Pratts of Carlow &lt;br&gt;
            Pollerton Road &lt;br&gt;
            Carlow &lt;br&gt;
            R93 FX20
          &lt;/blockquote&gt;
          &lt;blockquote&gt;
            &lt;h2&gt;CONTACTS&lt;/h2&gt;&lt;br&gt;
            Sales: &lt;a href="mailto:sales@prattsofcarlow.ie"&gt;sales@PrattsofCarlow&lt;/a&gt;&lt;br&gt;
            Service: &lt;a href="mailto:service@prattsofcarlow.ie"&gt;Service@PrattsofCarlow.ie&lt;/a&gt;&lt;br&gt;
            Parts: &lt;a href="mailto:parts@prattsofcarlow.ie"&gt;Parts@PrattsofCarlow.ie&lt;/a&gt;&lt;br&gt;
          &lt;/blockquote&gt;
          &lt;blockquote&gt;
            &lt;h2&gt;OPENING HOURS&lt;/h2&gt;
            9.00am-6.00pm Monday to Friday&lt;br&gt;
            10.00am-1.00pm saturday
          &lt;/blockquote&gt;
      &lt;/footer&gt;
  
      &lt;script src="scripts/mm.js"&gt;
      &lt;/script&gt;
  
      &lt;script src="scripts/exit.js"&gt;
      &lt;/script&gt;
      &lt;/body&gt;
  
      &lt;/html&gt;
  </code></pre>
  
  <p>and the footer css</p>
  
  <pre><code>    footer {
        position: relative;
        width: 100%;
        background-color: rgb(40,40,40);
        letter-spacing: 1px;
        font-size: 12px;
        font-family: helvetica;
      }
  
      footer h2 {
        font-weight: bold;
        color: rgb(200,200,200);
      }
  
      blockquote {
        color: rgb(200,200,200);
        padding: 20px;
        text-align: center;
      }
  
      blockquote a{
        text-decoration: none;
        color: rgb(230,100,90);
      }
  
      @media screen and (min-width: 680px){
        footer{
          display: flex;
          flex-flow: row nowrap;
          justify-content: space-between;
          align-items: center;
        }
      }
  </code></pre>
  
  <p>now heres the html for the login page its just some includes and an echo to print out some html</p>
  
  <pre><code>    &lt;?php
  
      include 'view/header.php';
  
      echo    "&lt;main id='login'&gt;
                  &lt;form action='access.php' method='post' id='form1'&gt;
                    &lt;input type='email' name='email' placeholder='email'&gt;
                    &lt;input type='password' name='password' placeholder='password'&gt;
                    &lt;button type='submit' form='form1' value='submit'&gt;Login&lt;/button&gt;
                  &lt;/form&gt;
               &lt;/main&gt;";
  
      include 'view/footer.php';
  
      ?&gt;
  </code></pre>
  
  <p>and the corresponding css</p>
  
  <pre><code>    #login {
        position: relative;
        width: 500px;
        height: 200px;
        margin: 0 auto;
        margin-top: 100px;
        margin-bottom: 400px;
        padding: 50px;
        background-color: grey;
        z-index: 0;
      }
  
      #login input {
        margin: 10px auto;
        display: block;
        width: 200px;
        border: none;
        background-color: grey;
        border-bottom: 1px solid white;
        color: white;
      }
  
      #login input::placeholder {
        color: white;
      }
  
      #login input:focus {
        outline: none;
        background-color: rgb(100,100,100);
      }
  
      #login button {
        margin: 10px auto;
        display: block;
        width: 200px;
        height: 20px;
        border: none;
        border-radius: 5px;
        background-color: rgb(230,100,90);
      }
  </code></pre>
  
  <p>so what do i have to fix to get the nav to behave and go above any other elements?</p>