0
コンテンツの量にかかわらず4つのボックス(赤、青、緑、黄色)の高さがすべて等しい2x2グリッドを作成しようとしています。ボックス内容量にもかかわらず2x2グリッドの等高さ
#rowTwo {
background-color: pink;
min-height: 25%;
display: flex;
flex-direction: column;
align-items: center;
}
#grid2x2 {
display: flex;
flex-direction: row;
flex-wrap: wrap;
background-color: orange;
width: 80%;
justify-content: center;
}
.box {
display: flex;
flex-basis: calc(50% - 20px);
margin: 5px;
justify-content: center;
padding-top: 5%;
overflow: hidden;
}
<div id={styles.rowTwo}>
<Heading title="My Title"/>
<div id={styles.grid2x2}>
<div id={styles.boxOne} className={styles.box}>
<DescriptionBoxItemWithHeading item={this.state.sectionTwoItems[0]}/>
</div>
<div id={styles.boxTwo} className={styles.box}>
<DescriptionBoxItemWithHeading item={this.state.sectionTwoItems[1]}/>
</div>
<div id={styles.boxThree} className={styles.box}>
<DescriptionBoxItemWithHeading item={this.state.sectionTwoItems[2]}/>
</div>
<div id={styles.boxFour} className={styles.box}>
<DescriptionBoxItemWithHeading item={this.state.sectionTwoItems[3]}/>
</div>
</div>
</div>
Iが直面する問題は、ボックスは、行の最大含有量の高さに展開することです。ここで
は私の問題を概説画像です:
誰もが私はこれを達成できる方法を知っているだろうか?
ダイナミックテンプレートコードなしで最終的に生成されたHTMLを提供してください... – Aziz
これはフレックスボックスでは不可能です。それは一方向の次元だけを等しくすることができます。同じ高さ(行)または幅(列)を持つことはできますが、同時に両方を持つことはできません。あなたはJSが必要です。 –
overflow-y:auto? – VXp