我正在嘗試使DIV使用純CSS填充其整個父容器。 height:100%
沒有做到這一點,在父Flexbox的或display:table
也沒有幫助:(Div應填充父級高度
在所附的代碼中,我們談論的最裏面 div.CodeMirror
在最新的Safari瀏覽器上出現的問題MacOS的。在Chrome中所有的罰款。
html, body, #root {margin: 0; padding: 0; height: 100%; }
.App {display: flex; flex-flow: column; height: 100%; }
div.editorContainer {flex: 1 1 auto; display: flex; margin-bottom: 1em;}
div.ReactCodeMirror {padding: 5px; width: 100%; background-color: #ddf;}
.CodeMirror {height: 100%; border: 1px solid #ccc;}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div id="root">
<div class="App">
<nav class="navbar navbar-default"></nav>
<div class="editorContainer">
<div style="background-color: #aaf; width: 160px;">Side bar</div>
<div class="ReactCodeMirror">
<div class="CodeMirror">Should fill light blue area</div>
</div>
</div>
</div>
</div>
製作'.ReactCodeMirror'' display:flex'。 – CBroe
@CBroe:沒有幫助(MacOS上的最新的Safari) – travelboy
可能的重複:http://stackoverflow.com/q/33636796/3597276 –