2017-11-09 11 views
0

height: 100%で別のdiv内に2つのdivが垂直に表示されています。下のdivは自動的にその高さのサイズを変更します。divの1つが自動サイズ調整の場合、2つのdivを縦に並べて表示します。

最初のdivがその高さに親を埋める方法はありますか?

#my_app { 
 
    background-color: #ff0000; 
 
    position: absolute; 
 
    top: 0; 
 
    left: 0; 
 
    bottom: 0; 
 
    width: 100%; 
 
} 
 

 
#top_container { 
 
    display: table-cell; 
 
    background-color: #00ff00; 
 
    height:auto; 
 
    width:100%; 
 
    margin-bottom: auto; 
 
} 
 

 
#container { 
 
    position: absolute; 
 
    bottom: 0; 
 
    left: 5%; 
 
    width: 90%; 
 
    background-color: #d8d8d8; 
 
    display: table-cell; 
 
} 
 

 
#edit_container { 
 
    margin: 20px; 
 
    min-height: 44px; 
 
    max-height: 80px; 
 
    width: 70%; 
 
    height: auto; 
 
    overflow: hidden; 
 
    background-color: #484040; 
 
    display: flex; 
 
    align-items: center; 
 
} 
 

 
#edit { 
 
    width: 100%; 
 
    margin: 0px 20px; 
 
    min-height: 20px; 
 
    max-height: 80px; 
 
    overflow: scroll; 
 
    line-height: 20px; 
 
    background-color: #ff5e2d; 
 
} 
 

 
#test { 
 
    position: absolute; 
 
    top: 0; 
 
    right: 20px; 
 
    bottom: 0; 
 
    width: 30%; 
 
    background-color: #ff0; 
 
    text-align: center; 
 
    margin-top: 20px; 
 
    margin-bottom: 20px; 
 
} 
 

 
[contentEditable=true]:empty:not(:focus):before { 
 
    content: attr(data-text); 
 
} 
 

 
[contentEditable=true]:empty:focus:before { 
 
    content: attr(data-text); 
 
} 
 

 
[contenteditable]:focus:after { 
 
    content: ''; 
 
}
<div id="my_app"> 
 
    <div id="top_container"> 
 
    NEW TEST 
 
    </div> 
 
    <div id="container"> 
 
    <div id="edit_container"> 
 
     <form> 
 
     <div id="edit" contenteditable="true" data-text="Insert text"></div> 
 
     </form> 
 
    </div> 
 
    <div id="test"> 
 
     ACTION 
 
    </div> 
 
    </div> 
 
</div>

そしてここにjsfiddleです:https://jsfiddle.net/RoxanaCristea/4460up4s/

は、事前にありがとうございます!

答えて

関連する問題