'CSS 2 columns 50% without floats [duplicate]

I want to set a 2 column div with width of 50% each without using any floats. I set the display property to inline-block. I get it right with 49% width but when I go to 50% the second div goes down.

  #first{
       background-color: aqua;
       display:inline-block;
       width: 50%;
            
   }
   #second{
       background-color: blueviolet;
       display: inline-block;
       width: 50%;
               
   }

I even tried to change box-sizing but it didn't work

Any ideas??

css


Solution 1:[1]

To do this use flex.

.container {
  display: flex;
}

.first,
.second {
  flex: 1;
  height: 60px;
}

.first {
  background: red;
}

.second {
  background: blue;
}
<div class="container">
  <div class="first"></div>
  <div class="second"></div>
</div>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vugar Taghiyev