Struggling to align text vertically in the middle of a parallax component? Check out this code setup:
<template>
<div id="app">
<div class="parallax">
<div class="d-flex justify-content-center">
<h3 class="mt-5">Center this div</h3>
</div>
</div>
</div>
</template>
If you're using SCSS for the parallax styling, here's an example:
.parallax {
height: 750px;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
Experimented with Bootstrap classes like 'centered'? Try this 'center-item' class:
.center-item {
display: flex;
align-items: center;
justify-content: center;
width: 50%;
margin: 0 auto;
}
Apply the 'center-item' class to your element within the parallax container:
<div class="parallax">
<div class="d-flex justify-content-center">
<h3 class="center-item">Center this div</h3>
</div>
</div>
Seeking guidance on how to achieve true vertical and horizontal alignment? Let's discuss the best approach!