Skip to content

Commit

Permalink
css study
Browse files Browse the repository at this point in the history
  • Loading branch information
cst9221 committed May 24, 2020
1 parent 03b03b7 commit 1f5247b
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 0 deletions.
60 changes: 60 additions & 0 deletions css4.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
.container {
background: beige;
height: 100vh;
display: flex;
/* ↓ default : row */
/* 중심축을 변경할 수 있다. reverse로 순서를 역으로 바꿀 수 있다. */
flex-direction: row;
/* ↓ default : nowrap */
/* box의 크기를 유지할지 결정한다.
wrap을 지정하면 화면이 좁아짐에 따라 아래쪽으로 정렬한다. */
flex-wrap: nowrap;
/* ↓ direction과 wrap을 한번에 작성할 수 있다. */
flex-flow: row wrap;
/* ↓ default : flex-start */
/* 순서는 그대로지만 중심축을 기준 시작, 중간, 끝 어느 곳에 맞춰 정렬할지 결정한다.*/
justify-content: space-between;
/* align-items은 items의 아이템들의 기준을 정한다. */
/* baseline은 text가 균등하게 보여지도록 한다. */
align-items: baseline;
/* justify-content는 중심축을 기준으로 item들을 배치한다면 align-content는
반대축의 item들을 배치한다.*/
align-content: center;
}
.item {
width: 40px;
height: 40px;
border: 1px solid black;
}

.item1 {
background: #d50000;
padding: 25px;
}
.item2 {
background: #aa00ff;
}
.item3 {
background: #304ffe;
}
.item4 {
background: #0091ea;
}
.item5 {
background: #00bfa5;
}
.item6 {
background: #64dd17;
}
.item7 {
background: #ffd600;
}
.item8 {
background: #ff6d00;
}
.item9 {
background: #dd2c00;
}
.item10 {
background: #263238;
}
24 changes: 24 additions & 0 deletions css4.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="kr" dir="ltr">
<head>
<meta charset="utf-8">
<title>css_study</title>
<link rel="stylesheet" href="css4.css">
</head>
<body>
<!-- FlexBox -->
<!-- emmet : div.container>div.item.item${$}*10 -->
<div class="container">
<div class="item item1">1</div>
<div class="item item2">2</div>
<div class="item item3">3</div>
<div class="item item4">4</div>
<div class="item item5">5</div>
<div class="item item6">6</div>
<div class="item item7">7</div>
<div class="item item8">8</div>
<div class="item item9">9</div>
<div class="item item10">10</div>
</div>
</body>
</html>
62 changes: 62 additions & 0 deletions css5.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
.container {
padding-top: 50px;
background: beige;
height: 30vh;
display: flex;
}

.item {
width: 40px;
height: 40px;
border: 1px solid black;
}

.item1 {
background: #ef9a9a;
/* flex-grow는 지정한 크기를 넘어갈 때 어떻게 할 것인가를 결정해주는것이다.
화면이 필요이상으로 커지면 item1,2,3은 화면을 채우기 위해 늘어나게 되고
늘어나는 비율이 3:1:1비율로 늘어나게 된다. (전체 크기가 3:1:1이 아니라 늘어나는비율을 말한다.) */
flex-grow: 3;
flex-shrink: 1;
}
.item2 {
background: #90caf9;
flex-grow: 1;
/* flex-shrink는 flex-grow와는 반대로 1:3:1의 비율로 줄어들게 된다.
페이지를 줄여보면 item2은 item1,item3보다 더 빠르게 줄어든다. */
flex-shrink: 3;
}
.item3 {
background: #ce93d8;
/* grow, shrink, basis */
flex: 1 1 auto;
/* 해당 item만 유동적이게 위치시킬수 있다. */
align-self: center;
}
/* ------------------------- */
.container1 {
padding-top: 50px;
background: #000;
height: 30vh;
display: flex;
}
.item1 {
width: 40px;
height: 40px;
border: 1px solid black;
}
.item1-1 {
background: #ef9a9a;
flex-basis: 60%;
}
.item1-2 {
background: #90caf9;
flex-basis: 30%
}
.item1-3 {
background: #ce93d8;
/* flex-basis는 auto로 지정하면 grow와 shrink를 따르지만 비율로 지정하게 되면
항상 비율을 유지하려 하게 된다(극단적인 상황X) */
flex-basis: 10%;
}
/* https://flexboxfroggy.com/#ko */
20 changes: 20 additions & 0 deletions css5.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="kr" dir="ltr">
<head>
<meta charset="utf-8">
<title>css_study</title>
<link rel="stylesheet" href="css5.css">
</head>
<body>
<div class="container">
<div class="item item1">1</div>
<div class="item item2">2</div>
<div class="item item3">3</div>
</div>
<div class="container1">
<div class="item1 item1-1">4</div>
<div class="item1 item1-2">5</div>
<div class="item1 item1-3ss">6</div>
</div>
</body>
</html>

0 comments on commit 1f5247b

Please sign in to comment.