I have two div in my page. When I apply a border to these boxes, they get margin from top; but when no border is applied, the boxes are displayed with no margin. Why?
.header {
  width: auto;
  height: 100px;
  background-color: gray;
  text-align: center;
  line-height: 50px;
  border: 1px solid black;
}
.menu {
  background-color: green;
  height: 80px;
  border: 1px solid black;
}<div class="header">
  <h1>title</h1>
</div>
<div class="menu"></div> 
     
    