I have looked at virtually every similar post on here and cannot figure this out. Why is my form only being centered horizontally and not vertically?
HTML
<body>
<div class="container">
<form>
<div class="profilePic">
<img src="https://cdn.pixabay.com/photo/2016/08/08/09/17/avatar-1577909_960_720.png" alt="Avatar"
class="avatar" />
</div>
<div class="formFields">
<input type="text" placeholder="Enter Username" name="uname" required />
<input type="password" placeholder="Enter Password" name="pass" required />
<button type="submit">Login</button>
</div>
<div class="formFields" style="background-color:#f1f1f1">
<span class="pass">Forgot <a href="#">Username</a> or </a> <a href="#">Password?</a></span>
</div>
</form>
</div>
</body>
CSS
body {
font-family: Arial, Helvetica, sans-serif;
background-color: #343a40;
}
.container {
display: flex;
align-items: center;
justify-content: center;
}
form {
border: 3px solid #f1f1f1;
background-color: rgb(228, 228, 228);
margin: auto;
width: 50%;
}
Current
I want the form centered horizontally and vertically.