I'm encountering an issue with Flexbox's flex-wrap: wrap
that appears to be causing additional white space below the div
.
This is how my setup looks (with class names for clarity):
<div class="viewheight-background">
<div class="header"></div>
<div class="vertically-centered-text"></div>
</div>
My CSS code is quite simple:
html, body{
height: 100%;
}
.viewheight-background {
min-height: 100%; /* Ensures a section of 100% screen height */
background-size: cover;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.vertically-centered-text {
align-self: center;
}
The reason why vertically-centered-text is within a div is because it contains a main heading and some subtext.
Removing "align-self: center
" results in proper wrapping of flex-items. However, there seems to be invisible white-space causing "align-self: center
" to sit below the center of its containing div
.
Any suggestions on how to solve this?
(Let me know if more details are needed)
EDIT:
Here is a reference Fiddle. I forgot to include html, body {height: 100%;}