문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
wiki:css:css_note:css_float-clear [2021/03/15 19:47] emblim98 |
wiki:css:css_note:css_float-clear [2023/01/13 18:44] (현재) |
||
|---|---|---|---|
| 줄 9: | 줄 9: | ||
| \\ | \\ | ||
| \\ | \\ | ||
| - | =====Source | + | =====The source |
| * [[https:// | * [[https:// | ||
| \\ | \\ | ||
| - | \\ | + | |
| ======The clear Property====== | ======The clear Property====== | ||
| - | '' | + | '' |
| \\ | \\ | ||
| - | '' | + | '' |
| - | * none - 양쪽에 | + | |
| - | * left - 좌측에 플로팅 | + | |
| - | * right - 우측에 플로팅 요소가 허용되지 않습니다. | + | |
| - | * both - 좌측 또는 우측에 플로팅 요소가 허용되지 않습니다. | + | |
| - | * inherit - 요소는 부모의 명확한 값을 상속 받습니다. | + | |
| \\ | \\ | ||
| - | '' | + | '' |
| \\ | \\ | ||
| - | float를 | + | * '' |
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | * '' | ||
| + | \\ | ||
| + | %%floats%% 속성을 제거할 | ||
| + | 요소가 좌측으로 | ||
| + | 플로트 | ||
| \\ | \\ | ||
| - | 하기의 예제는 좌측으로의 float를 지웁니다. .div의 좌측에 플로팅 요소가 허용되지 않음을 의미합니다.\\ | ||
| - | ====예제==== | ||
| - | <code html> | ||
| - | < | ||
| - | <html lang=" | ||
| - | < | + | ==== Example |
| - | <meta charset=" | + | 하기의 예제는 좌측으로의 플로트 속성을 제거합니다.\\ |
| - | <meta http-equiv=" | + | %%<div2>%% 요소가 좌측으로 플로트 된 %%<div1>%% 요소 아래에 위치된다는 것을 의미합니다.\\ |
| - | <meta name=" | + | <code css> |
| - | <title>Without/ | + | < |
| - | < | + | .div1 { |
| - | .div1 { | + | float: left; |
| - | float: left; | + | |
| - | | + | border: 3px solid #73ad21; |
| - | height: 50px; | + | } |
| - | margin: 10px; | + | |
| - | border: 3px solid green; | + | |
| - | } | + | |
| - | | + | |
| - | border: | + | |
| - | } | + | |
| + | } | ||
| - | | + | |
| - | float: left; | + | |
| - | | + | |
| - | height: 50px; | + | float: left; |
| - | margin: 10px; | + | } |
| - | | + | |
| - | } | + | |
| - | | + | |
| - | border: | + | border: |
| - | clear: left; | + | |
| - | } | + | |
| + | } | ||
| </ | </ | ||
| - | </ | + | |
| - | + | < | |
| - | < | + | |
| < | < | ||
| - | <div class=" | + | <div class=" |
| <div class=" | <div class=" | ||
| - | < | + | |
| - | | + | |
| - | | + | |
| </ | </ | ||
| - | < | + | < |
| < | < | ||
| - | <div class=" | + | <div class=" |
| - | <div class=" | + | <div class=" |
| - | | + | |
| + | | ||
| </ | </ | ||
| - | </body> | + | |
| - | + | ||
| - | </html> | + | |
| </ | </ | ||
| - | \\ | ||
| - | \\ | ||
| - | =====The clearfix Hack===== | ||
| - | 어떤 한 요소가 자신을 포함하고 있는 요소보다 크고 float된 경우, 컨테이너 외부로 넘치게 됩니다.\\ | ||
| - | 그리고 나서, 이 문제를 해결하기 위해, 요소를 포함하는 것에 '' | ||
| - | ====예제==== | ||
| - | <code html> | ||
| - | < | ||
| - | <html lang=" | ||
| - | < | + | ======The clearfix Hack====== |
| - | <meta charset=" | + | 플로트 된 요소가 플로트 된 요소를 포함하는 요소보다 더 큰 경우, 컨테이너 외부로 __넘치게 됩니다(overflow)__.\\ |
| - | <meta http-equiv=" | + | 이 문제를 해결하기 위해, clearfix hack을 추가할 수 있습니다.\\ |
| - | <meta name=" | + | |
| - | < | + | |
| - | < | + | |
| - | div { | + | |
| - | border: 3px solid green; | + | |
| - | padding: 5px; | + | |
| - | } | + | |
| - | .img1 { | + | ====예제==== |
| - | float: right; | + | <code css> |
| - | } | + | < |
| + | div { | ||
| + | | ||
| + | | ||
| + | | ||
| - | | + | |
| - | | + | float: right; |
| - | } | + | } |
| - | | + | |
| - | float: right; | + | float: right; |
| - | } | + | } |
| + | |||
| + | .clearfix { | ||
| + | | ||
| + | | ||
| </ | </ | ||
| - | </ | + | |
| - | + | < | |
| - | < | + | <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 |
| - | < | + | < |
| + | < | ||
| + | div { | ||
| + | border: 3px solid #4caf50; | ||
| + | padding: 5px; | ||
| + | } | ||
| - | </ | + | .img1 { |
| + | float: right; | ||
| + | } | ||
| + | .img2 { | ||
| + | float: right; | ||
| + | } | ||
| + | .clearfix:: | ||
| + | content: ''; | ||
| + | clear: both; | ||
| + | display: table; | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | <p> | ||
| + | This image is floated to the right. It is also taller than the element containing it, so it | ||
| + | overflows outside of its container: | ||
| + | </p> | ||
| + | <div> | ||
| + | <img class=" | ||
| + | Lorem ipsum dolor, sit amet consectetur adipisicing elit. Fugit... | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | < | ||
| + | |||
| + | <div class=" | ||
| + | <img class=" | ||
| + | Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt maxime rerum iste error. | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| {{tag> | {{tag> | ||