문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
wiki:css:css_note:css_float_examples [2021/03/16 09:27] emblim98 |
wiki:css:css_note:css_float_examples [2023/01/13 18:44] (현재) |
||
|---|---|---|---|
| 줄 4: | 줄 4: | ||
| * author | * author | ||
| * email : shlim@repia.com | * email : shlim@repia.com | ||
| - | * lastupdate | + | * lastupdate |
| </ | </ | ||
| <WRAP clear></ | <WRAP clear></ | ||
| 줄 15: | 줄 15: | ||
| ======Grid of Boxes / Equal Width Boxes====== | ======Grid of Boxes / Equal Width Boxes====== | ||
| '' | '' | ||
| - | ====예제==== | + | ==== Example |
| - | < | + | < |
| - | < | + | |
| - | <html lang=" | + | |
| - | + | ||
| - | < | + | |
| - | <meta charset=" | + | |
| - | <meta http-equiv=" | + | |
| - | <meta name=" | + | |
| - | < | + | |
| < | < | ||
| * { | * { | ||
| 줄 62: | 줄 54: | ||
| <p> | <p> | ||
| - | Note that w also us the clearfix hack to take care of the layout flow, and that add the box-sizing property to make sure that the box doesn' | + | Note that w also us the clearfix hack to take care of the layout flow, |
| - | | + | |
| + | | ||
| </p> | </p> | ||
| </ | </ | ||
| + | </ | ||
| - | </ | + | ====What is box-sizing? |
| - | </ | + | 3개의 플로팅 박스를 나란히 |
| - | \\ | + | 하지만 각 박스의 너비를 |
| - | ====3개의 플로팅 박스를 | + | '' |
| + | 패딩이 상자 내부에 유지되고 깨지지 않도록 할 수 있습니다.\\ | ||
| ===='' | ===='' | ||
| \\ | \\ | ||
| 줄 77: | 줄 72: | ||
| 박스의 그리드는 이미지를 나란히 보여주는 것에도 사용할 수 있습니다.\\ | 박스의 그리드는 이미지를 나란히 보여주는 것에도 사용할 수 있습니다.\\ | ||
| ====예제==== | ====예제==== | ||
| - | < | + | < |
| < | < | ||
| <html lang=" | <html lang=" | ||
| 줄 138: | 줄 133: | ||
| 하지만, quick fix는 고정 높이를 설정하는 것을 아래 예제에서 살펴보겠습니다.\\ | 하지만, quick fix는 고정 높이를 설정하는 것을 아래 예제에서 살펴보겠습니다.\\ | ||
| ====예제==== | ====예제==== | ||
| - | < | + | < |
| < | < | ||
| <html lang=" | <html lang=" | ||
| 줄 200: | 줄 195: | ||
| 하지만 많은 경우 | 하지만 많은 경우 | ||
| 자동으로 가장 긴 박스만큼 길게 박스를 늘릴 수 있는 CSS3 Flexbox가 이런 경우에 유용합니다.\\ | 자동으로 가장 긴 박스만큼 길게 박스를 늘릴 수 있는 CSS3 Flexbox가 이런 경우에 유용합니다.\\ | ||
| - | | + | \\ |
| + | ====예제==== | ||
| + | <code css> | ||
| + | < | ||
| + | <html lang=" | ||
| + | |||
| + | < | ||
| + | <meta charset=" | ||
| + | <meta http-equiv=" | ||
| + | <meta name=" | ||
| + | < | ||
| + | < | ||
| + | .flex-container { | ||
| + | display: flex; | ||
| + | flex-wrap: nowrap; | ||
| + | background-color: | ||
| + | } | ||
| + | |||
| + | .flex-container .box { | ||
| + | background-color: | ||
| + | width: 50%; | ||
| + | margin: 10px; | ||
| + | text-align: center; | ||
| + | line-height: | ||
| + | font-size: 30px; | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | |||
| + | <div class=" | ||
| + | <div class=" | ||
| + | Box 01 - This is some text to make sure that the content gets really tall. This is some text to make sur that the content gets really tall. | ||
| + | </ | ||
| + | <div class=" | ||
| + | Box 02 - My height will follow Box 01. | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | <p> | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | \\ | ||
| + | \\ | ||
| + | =====Navigation Menu===== | ||
| + | 하이퍼링크 목록과 '' | ||
| + | ====예제==== | ||
| + | <code css> | ||
| + | < | ||
| + | <html lang=" | ||
| + | |||
| + | < | ||
| + | <meta charset=" | ||
| + | <meta http-equiv=" | ||
| + | <meta name=" | ||
| + | < | ||
| + | < | ||
| + | ul { | ||
| + | list-style-type: | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | overflow: hidden; | ||
| + | background-color: | ||
| + | } | ||
| + | |||
| + | li { | ||
| + | float: left; | ||
| + | } | ||
| + | |||
| + | li a { | ||
| + | display: inline-block; | ||
| + | color: yellow; | ||
| + | text-align: center; | ||
| + | padding: 14px 16px; | ||
| + | text-decoration: | ||
| + | } | ||
| + | |||
| + | li a:hover { | ||
| + | background-color: | ||
| + | } | ||
| + | |||
| + | .active { | ||
| + | background-color: | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | \\ | ||
| + | \\ | ||
| + | =====Web Layout Example===== | ||
| + | '' | ||
| + | ====예제==== | ||
| + | <code css> | ||
| + | < | ||
| + | <html lang=" | ||
| + | |||
| + | < | ||
| + | <meta charset=" | ||
| + | <meta http-equiv=" | ||
| + | <meta name=" | ||
| + | < | ||
| + | < | ||
| + | * { | ||
| + | box-sizing: border-box; | ||
| + | } | ||
| + | |||
| + | .header, | ||
| + | .footer { | ||
| + | background-color: | ||
| + | color: white; | ||
| + | padding: 15px; | ||
| + | } | ||
| + | |||
| + | .column { | ||
| + | padding: 15px; | ||
| + | float: left; | ||
| + | } | ||
| + | |||
| + | .clearfix:: | ||
| + | content: ""; | ||
| + | clear: both; | ||
| + | display: table; | ||
| + | } | ||
| + | |||
| + | .menu { | ||
| + | width: 25%; | ||
| + | } | ||
| + | |||
| + | .content { | ||
| + | width: 75%; | ||
| + | } | ||
| + | |||
| + | .menu ul { | ||
| + | list-style-type: | ||
| + | margin: 0; | ||
| + | padding: 0; | ||
| + | } | ||
| + | |||
| + | .menu li { | ||
| + | padding: 8px; | ||
| + | margin-bottom: | ||
| + | background-color: | ||
| + | color: #ffffff; | ||
| + | } | ||
| + | |||
| + | .menu li:hover { | ||
| + | background-color: | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | |||
| + | <div class=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | <div class=" | ||
| + | <div class=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | <div class=" | ||
| + | < | ||
| + | <p> | ||
| + | Chania is the capital of the Chania region on the island of Crete. The city can be divided in two parts, the old town and the modern city. | ||
| + | </ | ||
| + | <p> | ||
| + | You will lern more about web layout an responsive web pages in a later chapter. | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | <div class=" | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| + | \\ | ||
| + | \\ | ||
| + | =====All CSS Float Properties===== | ||
| + | ^ Property | ||
| + | | box-sizing | ||
| + | | clear | 어떤 요소가 지워진 요소 옆에 그리고 어느 방향으로 플로트 되는지를 지정 | ||
| + | | float | 요소가 플로트 되는 방법을 지정 | ||
| + | | overflow | ||
| + | | overflow-x | ||
| + | | overflow-y | ||
| + | |||
| + | |||
| + | |||
| + | |||
| {{tag> | {{tag> | ||