I am trying to add some elements inside a container that has display: flex
.
The problem is that when I make the screen smaller it creates a gap between the elements that I have not set (or at least I do not think so).
I have created a JSFiddle that represents my problem.
As you can see, there is a blue space between the first and the second divs when you make the screen smaller.
How can I fix it?
Thanks in advance!
html,
body {
width: 100%;
height: 100%;
}
#container {
display: flex;
height: 100%;
background-color: blue;
}
.block {
flex: 1;
}
#left {
background-color: green;
}
#center {
display: flex;
flex: 1;
flex-wrap: wrap;
}
#right {
background-color: orange;
}
.flexContainer {
flex: 1;
width: 50%;
min-width: 100px;
max-width: 50%;
height: 150px;
background-color: red;
padding: 10px;
}
.flexDiv {
width: 100%;
height: 100%;
background-color: yellow;
}
<div id="container">
<div id="left" class="block">Left</div>
<div id="center" class="block">
<div class="flexContainer">
<div class="flexDiv"></div>
</div>
<div class="flexContainer">
<div class="flexDiv"></div>
</div>
</div>
<div id="right" class="block">Right</div>
</div>