フレックスボックスを使用したフルハイトアプリを使用したい。display: box;
このリンクで古いフレックスボックスレイアウトモジュール(およびその他のもの)を使用して欲しいものを見つけました: CSS3フレックスボックスフルハイトアプリとオーバーフロー
これは、古いバージョンのフレックスボックスCSSプロパティのみをサポートするブラウザに適したソリューションです。
新しいフレックスボックスのプロパティを使用したい場合は、ハックとしてリストされている同じリンクの2番目のソリューションを使用してみます。コンテナを使用しheight: 0px;
ます。縦スクロールを表示させます。
それは他の問題を引き起こし、解決策よりも回避策であるため、私はそれがあまり好きではありません。
html, body {
height: 100%;
}
#container {
display: flex;
flex-direction: column;
height: 100%;
}
#container article {
flex: 1 1 auto;
overflow-y: scroll;
}
#container header {
background-color: gray;
}
#container footer {
background-color: gray;
}
<section id="container" >
<header id="header" >This is a header</header>
<article id="content" >
This is the content that
<br />
With a lot of lines.
<br />
With a lot of lines.
<br />
This is the content that
<br />
With a lot of lines.
<br />
<br />
This is the content that
<br />
With a lot of lines.
<br />
<br />
This is the content that
<br />
With a lot of lines.
<br />
</article>
<footer id="footer" >This is a footer</footer>
</section>
基本例を使用してJSFiddleも準備しました:http://jsfiddle.net/ch7n6/
これはフルハイトのHTMLWebサイトであり、コンテンツ要素のフレックスボックスプロパティのため、フッターは下部にあります。異なる高さをシミュレートするには、CSSコードと結果の間でバーを移動することをお勧めします。