The Age old question ...and yes - there's 50 BILLION ones online already - So I've followed every tutorial on it I could find. But no matter what I do, even when I simplify it down to the most basic thing ever, I just can't center vertically, it only centers horizontally at most.
Does the issue have to do with my code? Or is it only me (as in something to do with how I'm previewing it?). It's probably just a stupid mistake but I don't know what it is...
(Below is the code I used for it. Super duper basic literally just a box.)
body {
background-color: gray;
}
.holder {
display: flex;
align-items: center;
}
.box {
background-color: brown;
width: 100px;
height: 100px;
border: 3px solid white
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- Title of the website. -->
<title>Under construction</title>
<!-- Below is the link to source my own css. -->
<link rel="stylesheet" href="mycool.css">
<!-- The viewport. -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="holder">
<div class="box"></div>
</div>
</body>
</html>
Screenshots of when I'm trying to preview it (both in VS Code and just straight up opening the file in my browser) VS Code Preview Opening it in Firefox
My end goal is to center it vertically and horizontally but it... just won't even center vertically on it's own