I am making my first html/css website and I have the start of a skeleton with placeholder images and icons. I want the icons with text, to each be centered within their respective column. I'm using a CSS grid to set up the columns.
.content-items-wrapper {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
.content-item-wrapper {
position: relative;
}
.content-img-background {
height: 350px;
width: 100%;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.img-text-wrapper {
position: absolute;
top: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
text-align: center;
padding-left: 100px;
padding-right: 100px;
}
<div class="master-content-wrapper">
<div class="content-items-wrapper">
<div class="content-item-wrapper">
<div class="content-img-background" style="background-image: URL(images/blue-placeholder.jpg)"></div>
<div class="img-text-wrapper">
<div class="logo-wrapper">
<img src="images/wrench-placeholder.png">
</div>
<div class="subtitle">
Services
</div>
</div>
</div>
<div class="content-item-wrapper">
<div class="content-img-background" style="background-image:URL(images/white-placeholder.jpg)"></div>
<div class="img-text-wrapper">
<div class="logo-wrapper">
<img src="images/computer-placeholder.png">
</div>
<div class="subtitle">
Technicians
</div>
</div>
</div>
<div class="content-item-wrapper">
<div class="content-img-background" style="background-image:URL(images/red-placeholder.jpg)"></div>
<div class="img-text-wrapper">
<div class="logo-wrapper">
<img src="images/paper-placeholder.png">
</div>
<div class="subtitle">
Reviews
</div>
</div>
</div>
</div>
I tried different paddings and tweaking some other things but it never gets exactly in the center of the three vertical columns. The icon with text I'm referring to is the ".img-text-wrapper" div.