I am learning to write HTML/CSS/JS and I am creating some mock websites to learn as I go. I started venturing into CSS Grid and am struggling to center align horizontally and vertically an item within a grid box. I find Grid very powerful in creating layouts and for some reason I am failing to understand this portion. I want to center the head-content-container
in the header.
In doing research I found THIS website and THIS one. I see they suggest using justify-self:center; and align-self:center; but for some reason I am not able to get it to work. It is possible that I have another issue that I do not quite understand. Here is a link to my github repo and below is a snippet of my code. Thank you in advance for any help you can give me.
<body>
<nav class="main-nav-wrapper">
<div class="nav-logo-wrapper">
<img class="nav-logo" src="img\T-Portfolio_Logo-02.svg" alt="Bolt Development Logo">
</div>
</nav>
<div class="grid-wrapper">
<header class="main-header">
<div class="head-content-container">
<h1>Bolt Development</h1>
</div>
</header>
</div>
</body>
EDIT: Forgot to add HTML snippet.
.grid-wrapper {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: 500px 500px 500px 500px 200px;
grid-template-areas: "head head head"
"main main main"
"portfolio_1 portfolio_2 portfolio_3"
"portfolio_4 portfolio_5 portfolio_6"
"footer footer footer";
}
.main-header {
grid-area: head;
background-image: url(https://placeimg.com/1000/800/tech);
background-size: cover;
grid-column: 1/4;
color: white;
}
.main-nav-wrapper {
display: grid;
grid-template-columns: repeat(8, 1fr);
height: 100px;
background-color: #191919;
}
.nav-logo-wrapper {
grid-column: 1/2;
padding: .5em;
max-height: 100%;
}
.nav-logo {
max-height: 100%;
}
.head-content-container {
grid-area: head;
align-self: center;
justify-self: center;
width: 50%;
}