CSS div 안에 컨텐츠가 있는데도 height 가 0 으로 되는 경우
페이지 정보
본문
div 로 사용할 때,
div 안에 컨텐츠가 있는 데도 감싸고 있는 div 의 height 가 0 으로 인식될 때가 있다.
div 안의 컨텐츠들이 float 되는 경우 발생할 수가 있는데,
이때는 감싸는 div 에 가상 선택자인 after 를 추가하여 높이를 줄 수 있다.
<div class="wrap">
<div style="float:left">aaa</div>
<div style="float:left">bbb</div>
</div>
<style>
.wrap:after {content:'';display:block;clear:both;}
</style>
div 안에 컨텐츠가 있는 데도 감싸고 있는 div 의 height 가 0 으로 인식될 때가 있다.
div 안의 컨텐츠들이 float 되는 경우 발생할 수가 있는데,
이때는 감싸는 div 에 가상 선택자인 after 를 추가하여 높이를 줄 수 있다.
<div class="wrap">
<div style="float:left">aaa</div>
<div style="float:left">bbb</div>
</div>
<style>
.wrap:after {content:'';display:block;clear:both;}
</style>
추천0
댓글목록
등록된 댓글이 없습니다.