"Div 2개 가로 배치"의 두 판 사이의 차이

26번째 줄: 26번째 줄:
   <div class='children child1'>
   <div class='children child1'>
     Hello World
     Hello World
  </div>
  <div class='children child2'>
    Lorem
  </div>
</div>
</syntaxhighlight>
==균형==
<syntaxhighlight lang='html' run>
<style>
.parent {
  background: red;
  display: flex;
}
.children {
  flex: auto;
}
.child1 {
  background: silver;
}
.child2 {
  background: skyblue;
}
</style>
<div class='parent'>
  <div class='children child1'>
    Hello World Hello World
   </div>
   </div>
   <div class='children child2'>
   <div class='children child2'>

2021년 10월 12일 (화) 22:47 판

1 개요

div 가로 2개 배치

2 반반

<style>
.parent {
  background: red;
  display: flex;
  flex-direction: row;
}

.child1 {
  background: silver;
  flex: auto;
}

.child2 {
  background: skyblue;
  flex: auto;
}
</style>

<div class='parent'>
  <div class='children child1'>
    Hello World
  </div>
  <div class='children child2'>
    Lorem
  </div>
</div>

3 균형

<style>
.parent {
  background: red;
  display: flex;
}
.children {
  flex: auto;
}
.child1 {
  background: silver;
}
.child2 {
  background: skyblue;
}
</style>

<div class='parent'>
  <div class='children child1'>
    Hello World Hello World
  </div>
  <div class='children child2'>
    Lorem
  </div>
</div>

4 전체 + 오른쪽

<style>
.parent {
  background: red;
  display: flex;
  flex-direction: row;
}
.child1 {
  background: silver;
  flex: auto;
}
.child2 {
  background: skyblue;
  width: 5rem;
}
</style>

<div class='parent'>
  <div class='children child1'>
    Hello World
  </div>
  <div class='children child2'>
    Lorem
  </div>
</div>

5 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}