To optimize the layout, one approach is to convert the entire body into a flex container and then make necessary adjustments. While this offers a more efficient solution, it may require significant CSS modifications. As a quick fix, you can position the text absolutely and center it by adding the following CSS to the class:
.display-1 {
font-weight: 500 !important;
letter-spacing: 40px;
transition: ease-in 1s;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
In this scenario, the body serves as the relative element, with your content positioned starting at 50% from the top and left edges of the body. The use of translate
ensures that the text remains centered within the layout by adjusting its position by -50% in both the horizontal and vertical axes.