You haven't given the code that you used but still I understand the issue.
You are using display: inline-flex;
on the three divs, inline flex is a property used for div containers and it will align all the divs inline.
a simple solution I would suggest is that you wrap a container around those divs and give the container the property of display: flex
here is the HTMl
<div class="container">
<div id="div1"></div>
<div id="div2"></div>
<div id="div3"></div>
</div>
here is the CSS
.container{
display: flex;
width: 100%;
}
#div1,#div2,#div3{
width: 100px;
height: 100px;
border: 2px solid #000;
}
@media (max-width: 400px) {
.container{
display: block;
}
}
also, here is a link so you can see it in action, resize the screen to see the media query in effect https://codepen.io/codebyrudra/pen/NWvyVzd