I've been learning CSS and am now practicing by trying to replicate basic websites, but I've stumbled across a problem!
I'm trying to vertically align a box so that it is always in the middle, and will automatically scale if I make the browser vertically smaller. So far I've tried to replicate what I've done horizontally (normally margin: 0 auto;) but it isn't working.
My relevant HTML and CSS so far look like this:
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
/* Global Values */
html{
  font-family: "Arial";
  font-size: 16px;
  line-height: 1.2;
  height: 100%;
}
body{
  background-color: #f9f9f9;
  height: 100%;
}
.container{
  display: block;
  min-width: 240px;
  max-width: 768px;
  width: 100%;
  
  /*----------------------------------------------*/
  /* This is to make sure that the container height is always the same size as the browser. */
  
  min-height: 100px; 
  height: 100%;  
  
  /*----------------------------------------------*/
  margin: 0 auto;
  text-align: center;
  border-style: solid;
}
header{
  border: solid;
  min-height: 100px;
  margin: auto 5%;
}<body>
    
    <div class="container">
      
      <header>
        
        <h1>Jon Phillips</h1>
        <p>User Interface Designer</p>
        
        <nav class="contact">
          
          <a href="mailto:jon@jonphillips.ca" target="_blank"><p>Contact</p></a>
        </nav>
      
      </header>
      
    </div>
  </body>I'm showing the borders so I can see what's going on, and am sure that (like horizontal centering) my margins need to be automatic. When I've done this horizontally, it's worked fine...
Does anyone have a recommendation on what to do??
Thanks in advance!
 
     
     
     
    