I didn’t change anything in the code.
Sometimes when I load the page the image is centered horizontally and vertically, but sometimes it is centered only horizontally.
.wavySectionContainer {
height: 100%;
width: 100%;
background-color: var(--primary);
position: relative;
}
.aboutMe,
.sun {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<div class="wavySectionContainer">
<img class="sun" src="public/sun.png" alt="Wave">
<p class="aboutMe">Lorem ipsum dolor sit amet consectetur adipisicing elit. Eligendi officia, mollitia cupiditate quae quos voluptatem dolorum? <br><br>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
</div>
2
Answers
Use height 100vh (viewport height) and width 100vw(viewport width)
OR
use fixed height and width in px(pixels) values, then you will get desired output.
Try this it will work fine.