I have a flex-container with some flex-items inside, and I have a large number (that I've wrapped in a span), that I want to have sit behind the text.
For some reason the z-index isn't working on this span item. According to the spec, flexbox should behave normally with both flex-containers and flex-items, but I can't seem to get the white text to sit on top of the black number? (or push the number behind the text, either is fine).
codepen: https://codepen.io/emilychews/pen/rpjpmB
CSS
.row {
display: flex;
margin: auto;
padding: 1rem;
background-color: red;
width: 70%;
max-width: 1043px;
box-sizing: border-box;
}
#row-2 {background: red;}
#row-2 div {
position: relative;
box-sizing: border-box;
margin: .5rem;
padding: 2.488rem 1rem;
flex: 1;
z-index: 1;
}
#number1 {position: absolute; font-size: 7.4300rem; z-index: 1;}
#row-2 > div > h3, #row-2 > div > p {text-align: center; color: white; z-index:99;}
HTML
<div id="row-2" class="row">
<div>
<span id="number1">01</span>
<h3>This is A Title</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<div>
<h3>This is A Title</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<div>
<h3>This is A Title</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
</div>