I have an element, which can contain 1-3 another elements. Let's say it's like this:
<div id="elem1">
<div class="inner_element">aaaa</div>
<div class="inner_element">bbbb</div>
</div>
The inner elements have to be positioned in column direction. I need their text to be centered vertically and horizontally.
I have my CSS like this:
#elem1 {
display: flex;
flex-direction: column;
}
.inner_element {
text-align: center;
flex: 1 100%;
}
The text is aligned horizontally, but I cannot find any combination of flex attributes, which will align the text vertically as well. Please, can anybody advice, how to center the text inside the inner elements vertically?