반응형
십자 축을 채우기 위해 아이들을 늘리는 방법?
왼쪽-오른쪽 flexbox가 있습니다.
.wrapper {
display: flex;
flex-direction: row;
align-items: stretch;
width: 100%;
height: 70vh;
min-height: 325px;
max-height:570px;
}
<div class="wrapper">
<div class="left">Left</div>
<div class="right">Right</div>
</div>
문제는 올바른 아이가 반응 적으로 행동하지 않는다는 것입니다. 구체적으로 래퍼의 높이를 채우고 싶습니다.
이를 수행하는 방법은 무엇입니까?
row-flexbox 컨테이너의 자식은 컨테이너의 수직 공간을 자동으로 채 웁니다.
flex: 1;
나머지 수평 공간을 채우려면 하위 항목을 지정하십시오 .
.wrapper {
display: flex;
flex-direction: row;
align-items: stretch;
width: 100%;
height: 5em;
background: #ccc;
}
.wrapper > .left
{
background: #fcc;
}
.wrapper > .right
{
background: #ccf;
flex: 1;
}
<div class="wrapper">
<div class="left">Left</div>
<div class="right">Right</div>
</div>
flex: 1;
동일한 양의 가로 공간을 채우려면 두 자식 모두에 대해 지정 합니다.
.wrapper {
display: flex;
flex-direction: row;
align-items: stretch;
width: 100%;
height: 5em;
background: #ccc;
}
.wrapper > div
{
flex: 1;
}
.wrapper > .left
{
background: #fcc;
}
.wrapper > .right
{
background: #ccf;
}
<div class="wrapper">
<div class="left">Left</div>
<div class="right">Right</div>
</div>
참고 URL : https://stackoverflow.com/questions/29467660/how-to-stretch-children-to-fill-cross-axis
반응형
'IT story' 카테고리의 다른 글
UIView의 setNeedsLayout, layoutIfNeeded 및 layoutSubviews 간의 관계는 무엇입니까? (0) | 2020.08.12 |
---|---|
하드웨어없이 CUDA 프로그래밍을위한 GPU 에뮬레이터 (0) | 2020.08.12 |
dSYM은 무엇이며 어떻게 사용합니까? (0) | 2020.08.12 |
파이썬은 반환 값으로 만 사용되는 변수를 최적화합니까? (0) | 2020.08.12 |
스위치가 더 빠른 이유 (0) | 2020.08.12 |