문제

I have a div with ID "containter" which contain 3 div with floated left property. When I use these floated div, the "container" div don't get height based on insided Div. What is the solution? Thank.

도움이 되었습니까?

해결책

Put clear property to restore the flow. My Codepen

HTML

<div id="container">

  <div class="coucou" ></div>
  <div class="coucou" ></div>
  <div class="coucou" ></div>

  <div class="clear"></div>
</div>

CSS

#container{
  width : 600px;
  background:pink;

}

.coucou {
  margin-left:2px;
  width :100px; 
  height:200px;
  float: left;
  background:blue; 
}
.clear {clear:both;}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top