TIL_20.06.30 πŸƒπŸ½β€β™‚οΈπŸƒπŸ½β€β™‚οΈ

Doum KimΒ·2020λ…„ 6μ›” 30일
0

TIL

λͺ©λ‘ 보기
7/71
post-thumbnail

Codestates pre course 15일차

μ˜€λŠ˜μ€ μ½”λ“œμŠ€ν…Œμ΄μΈ  프리 μ½”μŠ€ 15일차
μ˜€λŠ˜λΆ€ν„° html, css 파트 μ‹œμž‘.

css flexbox, grid 볡슡이 ν•„μš”ν•˜λ‹€. (μ•ˆ μ“°λ‹ˆκΉ λ‹€ κΉŒλ¨ΉλŠ”λ‹€...)
flex-shrink, flex-grow, flex-basis λ‹€μ‹œ 정리해보기.
flex-direction에 λ”°λ₯Έ align-items, justify-content base μΆ• μ™„λ²½νžˆ μˆ™μ§€ν•˜κΈ°.

μ‹œλ©˜ν‹± νƒœκ·Έλ„ ν•œλ²ˆ λ‹€μ‹œ μ­‰ λ³Ό ν•„μš”κ°€ μžˆμ–΄ 보이고 내일은 κ·Έλ¦¬λ“œ 봐야지.
μ˜€λžœλ§Œμ— λ§ˆν¬μ—… ν•΄λ³΄λ‹ˆκΉ κ·Έλž˜λ„ μž¬λ―Έκ°€ μžˆλ”λΌ.

index.html

<div class="flex-container container1">
  <div class="flex-item">box1</div>
  <div class="flex-item">box2</div>
  <div class="flex-item">box3</div>
</div>

style.css

.flex-container {
	display: flex;
	margin-bottom: 100px;
}

.flex-item {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 150px;
	height: 150px;
}

.container1 {
	justify-content: space-around;
	height: 100vh;
}

.container1 .flex-item:nth-of-type(1) {
	align-self: center;
}

.flex-item:nth-of-type(1) {
	background: lightpink;
	flex-grow: 2;
	flex-shrink: 2;
}
.flex-item:nth-of-type(2) {
	background: dodgerblue;
	flex-grow: 1;
	flex-shrink: 2;
}
.flex-item:nth-of-type(3) {
	background: lightcoral;
	flex-grow: 1;
	flex-shrink: 2;
}
.flex-item:nth-of-type(4) {
	background: lightgrey;
	flex-grow: 0;
	flex-shrink: 2;
}

index.html

<div class="flex-container container2">
  <div class="flex-item">box1</div>
  <div class="flex-item">box2</div>
  <div class="flex-item">box3</div>
  <div class="flex-item">box4</div>
</div>

style.css

.flex-container.container2 {
	flex-direction: column;
	justify-content: space-between;
	align-items: flex-start;
	align-content: space-between;
	background: rgba(0, 0, 0, 0.2);
	flex-wrap: wrap;
	height: 60vh;
}

0개의 λŒ“κΈ€