我有一個行方向flexbox嵌套在列方向flexbox中,但是當我想在子項中使用align-content
時,它不起作用。align-content無法在flex項目上工作
當我將父母的display:flex
替換爲display:block
時,它起作用。
在下面的代碼中,我們可以看到.row
align-content: flex-end;
不起作用。但如果我用display: block;
代替.column
display: flex;
,則align-content: flex-end;
起作用。
請問可以解決這個問題嗎?
body {
background-color: grey;
}
.column {
display: flex;
flex-flow: column nowrap;
justify-content: flex-start;
align-items: stretch;
background-color: green;
}
.row {
display: flex;
flex-flow: row wrap;
justify-content: space-around;
align-content: flex-end;
align-items: center;
background-color: red;
}
.row-test {
min-height: 200px;
}
span {
width: 30%;
background-color: orange;
}
<body class="column">
<section class="row row-test">
<span>Test Test Test Test Test Test Test Test Test</span>
<span>Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test</span>
</section>
</body>
已經完成! :/ –