I try to center the <input> element in the black <div> container, but it doesn't work. What am I doing wrong?
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}
header {
  background-color: #fafafa;
  width: 100%;
  height: 10%;
}
main {
  background-color: #000;
  width: 100%;
  height: 50%;
}
main input {
  position: absolute;
  top: 50%;
  left: 20%;
  width: 60%;
  height: 3em;
}
footer {
  background-color: #fafafa;
  width: 100%;
  height: 40%;
}<!DOCTYPE html>
<html>
<head>
  <title>Layout Example</title>
</head>
<body>
  <header></header>
  <main>
    <input type="text">
  </main>
  <footer></footer>
</body>
</html> 
     
     
     
     
    