My goal is to use flexbox to vertically align three div
blocks.
Even though I can successfully align them horizontally, I am facing issues with vertical alignment.
What could be the mistake in my approach?
.banner {
padding-top: 10px;
padding-bottom: 10px;
background-color: #01b9d5;
color: white;
height: 55px;
}
.banner-align {
display: flex;
align-items: center;
justify-content: center;
border: 1px solid green;
}
.banner-hero {
flex: 1;
align-self: center;
max-width: 50%;
border: 1px solid red;
text-align: center;
display: inline-block;
}
.banner-left {
align-self: flex-start;
flex: 1;
border: 1px solid green;
display: inline-block;
}
.banner-right {
align-self: flex-end;
flex: 1;
text-align: right;
border: 1px solid yellow;
display: inline-block;
}
Here's an illustration:
Check out this fiddle for a visual representation: https://jsfiddle.net/zqc1qfk1/1/