【发布时间】:2014-03-08 23:44:27
【问题描述】:
我正在尝试学习如何使用 flexbox 制作好看的“盒子”。 我制作了 3 列 flex 项目,但它们没有填满窗口(即每个主体高度占 33%)。在查看指南 (http://css-tricks.com/snippets/css/a-guide-to-flexbox/) 后,我尝试使用 flex-grow,但这不起作用。有谁知道如何做到这一点?
CSS:
.flexbox {
display: flex;
flex-flow: column wrap;
flex-grow: 1;
> div {
padding: 1rem;
&:nth-child(1) { background: #FF0000;}
&:nth-child(2) { background: #00FF15;}
&:nth-child(3) { background: #0015FF;}
}
}
html, body {
height: 100%;
font-size: 62,5%;
}
HTML:
<body>
<section class="flexbox">
<div>
<h1> This is the first box </h1> <p>It's a very cool looking box, I agree!</p>
</div>
<div>
<h2> This is the second box </h2> <p>Not nearly as cool, right?</p>
</div>
<div>
<h3> This is the third box </h3> <p>I'm not even going to mention this one.</p> </div>
</section>
</body>
【问题讨论】: