0

I am trying to place two divs side by side using css display: inline-block; property. But my divs are placed one below the other.

Link of fiddle:- https://jsfiddle.net/04cc1n8j/

HTML

<div class='outerDiv'>
  <div class='innerDiv1'></div>
  <div class='innerDiv2'></div>
</div>

CSS

.outerDiv{
  width:300px;
  height:200px;
  margin:0px;
  padding:0px;
}
.innerDiv1{
  width:100px;
  height:200px;
  display:inline-block;
  background-color:red;
  margin:0px;
  padding:0px;
}

.innerDiv2{
  width:200px;
  height:200px;
  display:inline-block;
  background-color:green;
  margin:0px;
  padding:0px;
}
Hunter Turner
  • 6,804
  • 11
  • 41
  • 56

1 Answers1

1

The width of the white-space between the inline-block elements is breaking your layout. This article should help.

Ito Pizarro
  • 1,607
  • 1
  • 11
  • 21