簡體   English   中英

具有 100% 高度 flex 容器的錯誤?

[英]Bug with with 100% height of flex container?

請參閱 jsbin。 在此處輸入鏈接描述

我在 flex 容器上有一些 100% 高度的錯誤。 當內容太多時,它會從容器中掉落

您忘記創建/打開

<div class="col col2"> 

<div class="col col1">
</div> place <div class="col col2"> after the ending div of col col1

也用這個替換你的css代碼:

html,body{
  height:100%; /*Having 100% stretches your content, try removing height:100%; and see the difference*/
}

.parent{
  padding:10px;
  background:#888;
  display:flex;
  flex-wrap:wrap; /*Using flex-wrap:wrap will wrap your second div class to the next line*/
  flex:1 0 auto;
}

.col1{
  background:yellow;
}

.col2{
  background:lightgreen;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM