-1

Can anyone suggest a way to undo the display property?

I have three divs which I gave the value; display: inline-flex; so that they would appear horizontally. When creating my media queries, I want to remove this so that they will appear vertically. I thought display: initial; would work but no luck. neither does targeting the divs individually with display: block;

Kameron
  • 10,240
  • 4
  • 13
  • 26

1 Answers1

0

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