문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
wiki:css [2022/10/11 18:15] dhan |
wiki:css [2023/01/13 18:44] (현재) |
||
---|---|---|---|
줄 14: | 줄 14: | ||
===== Case Study ===== | ===== Case Study ===== | ||
+ | ===== FlexBox ===== | ||
+ | <code txt> | ||
+ | float: {left, center, right} | ||
+ | 이미지와 텍스트의 배치와 관련된 기능 | ||
+ | |||
+ | container 속성 | ||
+ | display | ||
+ | flex-direction | ||
+ | flex-wrap | ||
+ | flex-flow | ||
+ | justify-content | ||
+ | align-items | ||
+ | align-content | ||
+ | |||
+ | iterm 속성 | ||
+ | order | ||
+ | flex-grow | ||
+ | flex-shrink | ||
+ | flex | ||
+ | align-self | ||
+ | |||
+ | main axis(중심축), | ||
+ | |||
+ | EMMET(에밋) | ||
+ | div.container> | ||
+ | |||
+ | |||
+ | .container { | ||
+ | background: beige; | ||
+ | height: 100vh; /* viewport height */ | ||
+ | display: flex; | ||
+ | flex-direction: | ||
+ | row: 왼쪽에서 오른쪽으로 | ||
+ | row-reverse; | ||
+ | column: 위에서 아래로 | ||
+ | column-reverse: | ||
+ | flex-wrap: nowrap; 디폴트, | ||
+ | wrap | ||
+ | wrap-reverse | ||
+ | /* flex-flow: column nowrap */ flex-direction, | ||
+ | justify-content: | ||
+ | flex-start: | ||
+ | flex-end: | ||
+ | center | ||
+ | space-around, | ||
+ | align-items: | ||
+ | align-content: | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | .item { | ||
+ | width: 40px; | ||
+ | height: 40px; | ||
+ | border: 1px solid black; | ||
+ | } | ||
+ | |||
+ | iterm 속성 | ||
+ | .item1 { | ||
+ | backtround: #ef9a9a; | ||
+ | flex-grow: 2; /* 늘어나는 비중 */ | ||
+ | flex-shrink: | ||
+ | flex-basis: 60%; /* 차지하는 비중, flex-grow, flxe-shrink와 같이 사용하지 않음 */ | ||
+ | align-self: center; /* 아이템별로 지정 */ | ||
+ | } | ||
+ | | ||
+ | .item2 { | ||
+ | backtround: #ef9a9a; | ||
+ | flex-grow: 1; | ||
+ | flex-shrink: | ||
+ | flex-basis: 60%; | ||
+ | } | ||
+ | |||
+ | .item3 { | ||
+ | backtround: #ef9a9a; | ||
+ | flex-grow: 1; | ||
+ | flex-shrink: | ||
+ | flex-basis: 60%; | ||
+ | } | ||
+ | | ||
+ | </ | ||
+ | |||
+ | |||
+ | 실습 [[https:// | ||
+ | 컬러 [[https:// | ||
+ | [[https:// | ||
+ | \\ | ||
===== Grid ===== | ===== Grid ===== | ||
<code txt> | <code txt> | ||
줄 26: | 줄 113: | ||
부모 display: grid | 부모 display: grid | ||
| | ||
- | grid-template-columns: | + | grid-template-columns: |
+ | grid-template-columns: | ||
+ | grid-template-columns: | ||
+ | grid-template-columns: | ||
+ | grid-template-columns: | ||
+ | grid-template-columns: | ||
+ | | ||
grid-template-rows | grid-template-rows | ||
+ | grid-auto-rows: | ||
+ | grid-auto-rows: | ||
- | gird-template-areas | + | gird-template-areas: grid cell labeling |
- | grid-gap | + | grid-gap: 10px |
- | grid-column-gap | + | grid-column-gap: 10px |
- | grid-row-gap | + | grid-row-gap: 10px |
자식 grid cell | 자식 grid cell | ||
- | grid-column-steart | + | grid-column-start, grid-column-end, |
- | grid-column-end | + | |
- | grid-row-start | + | |
- | grid-row-end | + | grid-row-start: 1; |
+ | grid-row-end: 3 | ||
+ | or | ||
+ | grid-column: | ||
+ | grid-row: 1 / 3; | ||
+ | |||
+ | or | ||
+ | grid-column: | ||
+ | grid-row: 1 / 3; | ||
+ | , | ||
+ | grid-column: | ||
+ | grid-row: 1 / 3; | ||
+ | |||
grid-area | grid-area | ||
+ | | ||
- | </ | + | body { |
+ | padding: 5rem; | ||
+ | background-color: | ||
+ | } | ||
+ | .container { | ||
+ | display: grid; | ||
+ | grid-template-columns: | ||
+ | grid-auto-rows: | ||
+ | grid-gap: 1rem; | ||
+ | gird-template-areas: | ||
+ | 'a a a' | ||
+ | 'b c c' | ||
+ | 'b d g' | ||
+ | 'e f g' | ||
+ | } | ||
- | <code css> | + | .image { |
+ | width: 100%; | ||
+ | height: 100%; | ||
+ | object-fit: cover; | ||
+ | } | ||
+ | |||
+ | .image1 { | ||
+ | grid-area: a | ||
+ | } | ||
+ | |||
+ | .image2 { | ||
+ | grid-area: b | ||
+ | } | ||
+ | |||
+ | .image3 { | ||
+ | grid-area: c | ||
+ | } | ||
+ | |||
+ | .image4 { | ||
+ | grid-area: d | ||
+ | } | ||
+ | |||
+ | .image5 { | ||
+ | grid-area: e | ||
+ | } | ||
+ | |||
+ | .image6 { | ||
+ | grid-area: f | ||
+ | } | ||
+ | |||
+ | .image7 { | ||
+ | grid-area: g | ||
+ | } | ||
</ | </ | ||
- | [[https:// | + | <code css> |
- | [[https:// | + | body { |
- | [[https:// | + | width: 100vw; |
+ | | ||
+ | | ||
+ | display: grid; | ||
+ | grid-template-columns: | ||
+ | grid-templat-rows: | ||
+ | grid-template-areas: | ||
+ | ' | ||
+ | 'main side' | ||
+ | ' | ||
+ | } | ||
+ | |||
+ | header { | ||
+ | grid-area: header; | ||
+ | } | ||
+ | |||
+ | main { | ||
+ | grid-area: main; | ||
+ | } | ||
+ | |||
+ | aside { | ||
+ | grid-area: side; | ||
+ | } | ||
+ | |||
+ | footer { | ||
+ | grid-area: footer; | ||
+ | } | ||
+ | |||
+ | </code> | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
===== Plugin ===== | ===== Plugin ===== | ||
줄 192: | 줄 379: | ||
===== CSS Note ==== | ===== CSS Note ==== | ||
* [[wiki: | * [[wiki: | ||
+ | * [[https:// | ||
\\ | \\ | ||
{{tag> | {{tag> |