float : The clearfix Hack(clearfix 해킹)
float : The clearfix Hack(clearfix 해킹)
요소가 포함 된 요소보다 크고 떠 다니면 해당 요소가 컨테이너 외부로 넘칠 것입니다.
그런 다음 overflow: auto;이 요소를 포함하여이 문제를 해결할 수 있습니다.
예
.clearfix {
overflow: auto;
}
<!DOCTYPE html>
<html>
<head>
<style>
div {
border: 3px solid #73AD21;
}
.img1 {
float: right;
}
.clearfix {
overflow: auto;
}
.img2 {
float: right;
}
</style>
</head>
<body>
<p>In this example, the image is taller than the element containing it, and it is floated, so it overflows outside of its container:</p>
<div><img class="img1" src="w3css.gif" alt="W3Schools.com" width="100" height="140">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum...</div>
<p style="clear:right">Add a clearfix class with overflow: auto; to the containing element, to fix this problem:</p>
<div class="clearfix"><img class="img2" src="w3css.gif" alt="W3Schools.com" width="100" height="140">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum...</div>
</body>
</html>

게시판 목록
퍼블리셔팁
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 797 | HTML | 8년 전 | 1706 | ||
| 796 | HTML | 8년 전 | 1517 | ||
| 795 | HTML | 8년 전 | 3301 | ||
| 794 | 기타 | 8년 전 | 2245 | ||
| 793 | HTML | 8년 전 | 3752 | ||
| 792 | HTML | 8년 전 | 1850 | ||
| 791 | 반응형 | 9년 전 | 2555 | ||
| 790 | HTML | 9년 전 | 10035 | ||
| 789 | HTML | 9년 전 | 5737 | ||
| 788 | CSS | 9년 전 | 2488 | ||
| 787 | 반응형 | 9년 전 | 3262 | ||
| 786 | 웹접근성 | 9년 전 | 3453 | ||
| 785 | 웹접근성 | 9년 전 | 2378 | ||
| 784 | 기타 | 9년 전 | 2386 | ||
| 783 | CSS | 9년 전 | 2239 | ||
| 782 | CSS | 9년 전 | 2409 | ||
| 781 | CSS | 9년 전 | 3944 | ||
| 780 | 반응형 | 9년 전 | 4299 | ||
| 779 | CSS | 9년 전 | 3144 | ||
| 778 | 반응형 | 9년 전 | 3280 | ||
| 777 | 반응형 | 9년 전 | 7634 | ||
| 776 | CSS | 9년 전 | 4776 | ||
| 775 | CSS | 9년 전 | 5386 | ||
| 774 | CSS | 9년 전 | 4608 | ||
| 773 | 반응형 | 9년 전 | 3596 | ||
| 772 | CSS | 9년 전 | 2985 | ||
| 771 | 웹접근성 | 9년 전 | 3527 | ||
| 770 | HTML | 9년 전 | 3737 | ||
| 769 | HTML | 9년 전 | 2371 | ||
| 768 | 9년 전 | 2399 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기