I have two <div> elements I want to be displayed above each other and centered on the horizontal (x) axis.
I was looking for a way to do that and found display: flex with align-items: center and justify-content: center as an answer.
I got them centered and positioned above each other, the problem now is, that the content of the two div elements overlaps each other when I zoom in.
By using overflow: hidden I found out, that the content of the first upper div overflows it's area (on zoom) at the bottom, because it gets cut off at the bottom using the hidden property.
I tried to use flex-shrink: 0 with flex-width: 0 and flex-height: 0 because I read online that it should help to dynamically size the container.
<div class="upper-div">
...
</div>
<div class="bottom-div">
...
</div>
.upper-div {
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
//flex-shrink: 0;
//flex-width: 0;
//flex-height: 0;
}
.bottom-div {
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}