문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
wiki:css:css_note:css_float-clear [2021/07/26 15:19] emblim98 |
wiki:css:css_note:css_float-clear [2023/01/13 18:44] (현재) |
||
|---|---|---|---|
| 줄 77: | 줄 77: | ||
| </ | </ | ||
| </ | </ | ||
| - | \\ | + | |
| - | \\ | + | ======The clearfix Hack====== |
| - | =====The clearfix Hack===== | + | 플로트 된 요소가 |
| - | 어떤 한 요소가 | + | 이 문제를 해결하기 위해, |
| - | 그리고 나서, | + | |
| ====예제==== | ====예제==== | ||
| - | < | + | < |
| - | <!DOCTYPE html> | + | <style> |
| - | <html lang=" | + | div { |
| + | border: 3px solid #4caf50; | ||
| + | padding: 5px; | ||
| + | } | ||
| - | < | + | |
| - | <meta charset=" | + | |
| - | <meta http-equiv=" | + | } |
| - | <meta name=" | + | |
| - | < | + | |
| - | < | + | |
| - | | + | |
| - | border: 3px solid green; | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | float: right; | + | float: right; |
| - | } | + | } |
| - | | + | |
| - | overflow: auto; | + | overflow: auto; |
| - | } | + | } |
| - | + | ||
| - | .img2 { | + | |
| - | float: right; | + | |
| - | | + | |
| </ | </ | ||
| - | </ | + | |
| - | + | < | |
| - | < | + | <h2>Without |
| - | + | ||
| - | < | + | |
| <p> | <p> | ||
| - | In this example, the image is taller than the element containing it, and it is floated, so it overflows | + | This image is floated to the right. It is also taller than the element containing it, so it |
| + | | ||
| </p> | </p> | ||
| <div> | <div> | ||
| - | | + | |
| - | Lorem ipsum dolor sit amet, consectetur | + | Lorem ipsum dolor, sit amet consectetur |
| </ | </ | ||
| - | <p style=" | + | |
| - | | + | |
| + | We can fix this by adding | ||
| </p> | </p> | ||
| <div class=" | <div class=" | ||
| - | | + | |
| - | Lorem ipsum dolor sit amet, consectetur | + | Lorem ipsum dolor, sit amet consectetur |
| </ | </ | ||
| - | + | | |
| - | </body> | + | |
| - | + | ||
| - | </html> | + | |
| </ | </ | ||
| \\ | \\ | ||
| - | '' | + | '' |
| \\ | \\ | ||
| - | ====예제==== | + | ==== Example |
| - | < | + | < |
| - | <!DOCTYPE html> | + | <style> |
| - | <html lang=" | + | div { |
| + | border: 3px solid #4caf50; | ||
| + | padding: 5px; | ||
| + | } | ||
| - | < | + | |
| - | <meta charset=" | + | |
| - | <meta http-equiv=" | + | } |
| - | <meta name=" | + | |
| - | < | + | |
| - | < | + | |
| - | | + | |
| - | border: 3px solid green; | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | float: right; | + | float: right; |
| - | } | + | } |
| - | | + | |
| - | content: | + | content: |
| - | clear: both; | + | clear: both; |
| - | display: table; | + | display: table; |
| - | } | + | } |
| - | + | ||
| - | .img2 { | + | |
| - | float: right; | + | |
| - | | + | |
| </ | </ | ||
| - | </ | + | |
| - | + | <body> | |
| - | < | + | < |
| <p> | <p> | ||
| - | In this example, the image is taller than the element containing it, and it is floated, so it overflows | + | This image is floated to the right. It is also taller than the element containing it, so it |
| + | | ||
| </p> | </p> | ||
| <div> | <div> | ||
| - | < | + | |
| - | | + | Lorem ipsum dolor, sit amet consectetur |
| - | Lorem ipsum dolor sit amet, consectetur | + | |
| </ | </ | ||
| - | <p style=" | + | <h2>With New Modern Clearfix</ |
| - | Add a clearfix | + | < |
| - | | + | |
| <div class=" | <div class=" | ||
| - | | + | |
| - | Lorem ipsum dolor sit amet, consectetur | + | Lorem ipsum dolor sit amet, consectetur |
| </ | </ | ||
| - | + | | |
| - | </body> | + | |
| - | + | ||
| - | </html> | + | |
| </ | </ | ||
| {{tag> | {{tag> | ||