Reputation: 7237
.container {
display: flex;
flex-direction: column;
justify-content: center;
}
.container span {
border-bottom: 1px solid red;
}
<div class="container">
<span>title</span>
<div class="content">
</div>
</div>
I want title to appear in the middle of the screen, as old inline element. But inside a flex container, it's expanded like block-level elements.
What am I missing here?
Demo: https://jsfiddle.net/rk5h5ph7/
Upvotes: 0
Views: 56
Reputation:
I don’t fully understand what you want, but try one of what I’ve suggested.
Try to add this to .container span
:
text-align: center;
or add this to .container
:
align-items: center;
Upvotes: 3
Reputation: 15796
Replace justify-content with align-itmes
.container {
display: flex;
flex-direction: column;
align-items: center;
}
.container span {
border-bottom: 1px solid red;
}
<div class="container">
<span>title</span>
<div class="content">
</div>
</div>
Upvotes: 1