Hey so I have this div and inside the div I have a button. I wanted to center the div horizontally and vertically. Also I wanted to center the button horizontally and vertically inside the div. Here is my code.
<div style='position: relative; left: calc(50% - 250px); top: calc(50% - 100px); border: 1px solid black; width: 500px; height: 200px;'>
  <button style='position: absolute; width: 100px; height: 30px; left: calc(50% - 50px); top: calc(50% - 15px);'>
    Submit
  </button>
</div>The button positioning works fine inside the div. However I am curious why the div will center horizontally but not vertically? I am assuming it has something to do with the position: relative? But I am not sure.
Thanks for your help!
 
     
    