I have a container <article>
container which is display: flex
. It contains some <div>
but also an <h2>
.
The <article>
has align-items: stretch
so that items within the container appear as full-height, as shown below. How can I align the text of the H2 to the center while preserving the full-height appearance (without adding another container around it?)
Example HTML:
body {
font-family: Arial;
font-size: 10pt;
min-height: 100vh;
display: flex;
flex-direction: column;
}
body article {
flex: 1;
display: flex;
align-items: stretch;
}
body article+article {
border-top: solid 1px silver;
}
body article h2 {
text-align: center;
flex: 1;
max-width: 16.6%;
padding: 10px;
margin: 10px;
background-color: black;
color: white;
}
body article section {
flex: 1;
}
<article>
<h2>Feature delivery</h2>
<section class="G">
<h3>xxx</h3>
<div class="lead xxx"></div>
<div class="narrative"></div>
</section>
<section class="A">
<h3>xxx</h3>
<div class="lead xxx"></div>
<div class="narrative">
xxx
</div>
</section>
<section class="R">
<h3>xxx</h3>
<div class="lead xxx"></div>
<div class="narrative">
xxx
</div>
</section>
<section class="R">
<h3>xxx</h3>
<div class="lead xxx"></div>
<div class="narrative">
xxx
</div>
</section>
<section class="A">
<h3>xxx</h3>
<div class="lead xxx"></div>
<div class="narrative">
xxx
</div>
</section>
</article>
<article>
<h2>Optimisation and stability</h2>
<section class="R">
<h3>xxxx</h3>
<div class="lead xxxx"></div>
<div class="narrative">
xxx
</div>
</section>
</article>
<article>
<h2>Team</h2>
</article>