I'm new to flexbox. My goal with the code is to vertically and horizontally center the text in the container div.
Why isn't the text being center aligned? Do I need to add a text-align:center
? Shouldn't flexbox be doing that for me?
.container {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
background: #efefef;
}
.content {
box-sizing: border-box;
padding: 24px;
}
<div class="container">
<div class="content">
<div>Some text here and here and here...</div>
<div>a little less text...</div>
</div>
</div>