I'm struggling with understanding flexbox and couldn't find any clear explanation on the W3 page about how to remove the extra spacing between containers.
For example, in one of their demos, I'm unsure how to achieve a layout similar to left, center, and right floats while eliminating the excess grey space within the container.
Is there a way to only display the children elements without showing the background of the container?
.flex-container {
display: -webkit-flex;
display: flex;
width: auto;
height: auto;
background-color: lightgrey;
}
.flex-item {
background-color: cornflowerblue;
width: auto;
height: auto;
margin: 0px;
border: 1px solid black;
}
<div class="flex-container">
<div class="flex-item">flex item 1</div>
<div class="flex-item">flex item 2</div>
<div class="flex-item">flex item 3</div>
</div>