In the following Html structure, I can't get the span after the Font Awesome icon to be centered like the spans in the other div:
.container {
display: flex;
flex-direction: column;
align-items: center;
width: 60px;
height: 200px;
padding: 5px;
}
.container span{
display: inline-block;
}
.container div{
display: flex;
align-content: center;
flex-direction: column;
}
<head>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
</head>
<div class="container">
<div>
<span>1</span>
<span>1</span>
</div>
<div>
<span><i class="fas fa-battery-quarter"></i></span>
<span>2</span> <!-- this is not centered -->
</div>
</div>
<!-- longer text shows that the icon is not center either -->
<div class="container">
<div>
<span>1</span>
<span>1</span>
</div>
<div>
<span><i class="fas fa-battery-quarter"></i></span>
<span>2222</span> <!-- this is not centered -->
</div>
</div>
The first div with the 2 spans is centered perfectly, I figured it has something to do with the icon, but i don't know what the problem is, what do I have to do in order to center the text below the icon too ?
Update: It seems it has something to do with the icon, if the text is longer, the icon is not centered either.
If am using align content on the flex containers and that centers the items in the first div, why doesn't it work on the second div with the icon ?